cleanup + docs

This commit is contained in:
Victor Brekenfeld 2021-05-13 19:38:28 +02:00
parent 0b0067a3fd
commit f0e7ff3312
4 changed files with 8 additions and 3 deletions

View File

@ -1,7 +1,6 @@
//! Type safe native types for safe egl initialisation //! Type safe native types for safe egl initialisation
use std::collections::HashSet; use std::collections::HashSet;
use std::fmt;
use std::ffi::CStr; use std::ffi::CStr;
use std::mem::MaybeUninit; use std::mem::MaybeUninit;
use std::ops::Deref; use std::ops::Deref;

View File

@ -211,7 +211,7 @@ pub enum TextureCreationError {
/// Texture format types /// Texture format types
#[repr(i32)] #[repr(i32)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub enum Format { pub enum Format {
/// RGB format /// RGB format
RGB = ffi::egl::TEXTURE_RGB as i32, RGB = ffi::egl::TEXTURE_RGB as i32,
@ -269,6 +269,11 @@ impl EGLBuffer {
Some(self.images[plane]) Some(self.images[plane])
} }
} }
/// Returns the underlying images
pub fn into_images(mut self) -> Vec<EGLImage> {
self.images.drain(..).collect()
}
} }
#[cfg(feature = "wayland_frontend")] #[cfg(feature = "wayland_frontend")]

View File

@ -16,7 +16,6 @@ use input::event;
use std::path::Path; use std::path::Path;
use std::{ use std::{
collections::hash_map::HashMap, collections::hash_map::HashMap,
fmt,
io::Error as IoError, io::Error as IoError,
os::unix::io::{AsRawFd, RawFd}, os::unix::io::{AsRawFd, RawFd},
}; };

View File

@ -246,6 +246,7 @@ pub trait Renderer {
} }
} }
/// Returns the dimensions of a wl_buffer
#[cfg(all(feature = "wayland_frontend", feature = "backend_egl"))] #[cfg(all(feature = "wayland_frontend", feature = "backend_egl"))]
pub fn buffer_dimensions(buffer: &wl_buffer::WlBuffer, egl_buffer_reader: Option<&EGLBufferReader>) -> Option<(i32, i32)> { pub fn buffer_dimensions(buffer: &wl_buffer::WlBuffer, egl_buffer_reader: Option<&EGLBufferReader>) -> Option<(i32, i32)> {
if let Some((w, h)) = egl_buffer_reader.as_ref().and_then(|x| x.egl_buffer_dimensions(&buffer)) { if let Some((w, h)) = egl_buffer_reader.as_ref().and_then(|x| x.egl_buffer_dimensions(&buffer)) {
@ -257,6 +258,7 @@ pub fn buffer_dimensions(buffer: &wl_buffer::WlBuffer, egl_buffer_reader: Option
} }
} }
/// Returns the dimensions of a wl_buffer
#[cfg(all(feature = "wayland_frontend", not(feature = "backend_egl")))] #[cfg(all(feature = "wayland_frontend", not(feature = "backend_egl")))]
pub fn buffer_dimensions(buffer: &wl_buffer::WlBuffer) -> Option<(i32, i32)> { pub fn buffer_dimensions(buffer: &wl_buffer::WlBuffer) -> Option<(i32, i32)> {
use crate::backend::allocator::Buffer; use crate::backend::allocator::Buffer;