pub fn create_buffer(
        this: ObjectRef<Self>,
        client: &mut Client,
        offset: u32,
        width: i32,
        height: i32,
        stride: i32,
        format: wl_shm::Format,
    ) -> Result<Buffer, Error> {
        ftrace::duration!("wayland", "ShmPool::create_buffer");
        // TODO(tjdetwiler): Support sending the protocol-modeled errors,
        // ex: wl_shm::Error::InvalidFormat.
        let format = pixel_format_wl_to_fuchsia(format)
            .ok_or_else(|| format_err!("Invalid pixel format {:?}", format))?;

        let image_info = images::ImageInfo {
            width: width as u32,
            height: height as u32,
            stride: stride as u32,
            pixel_format: format,
            transform: images::Transform::Normal,
            color_space: images::ColorSpace::Srgb,
            tiling: images::Tiling::Linear,
            alpha_format: images::AlphaFormat::Opaque,
        };
        let this = this.get(client)?;
        Ok(Buffer::new(this.memory.clone(), offset, image_info))
    }
/// Creates a new wl_buffer object backed by memory from this wl_shm_pool.
///
/// It's possible for the resultant wl_buffer to outlive this pool, so the
/// buffer must hold a strong reference to any resources it depends on
/// post-creation.
Creates a new wl_buffer object backed by memory from this wl_shm_pool.
It's possible for the resultant wl_buffer to outlive this pool, so the
buffer must hold a strong reference to any resources it depends on
post-creation.
Creates a new wl_buffer object backed by memory from this wl_shm_pool . It ' s possible for the resultant wl_buffer to outlive this pool so the buffer must hold a strong reference to any resources it depends on post - creation .
pub fn create_buffer(
        this: ObjectRef<Self>,
        client: &mut Client,
        offset: u32,
        width: i32,
        height: i32,
        stride: i32,
        format: wl_shm::Format,
    ) -> Result<Buffer, Error> {
        ftrace::duration!("wayland", "ShmPool::create_buffer");
        // TODO(tjdetwiler): Support sending the protocol-modeled errors,
        // ex: wl_shm::Error::InvalidFormat.
        let format = pixel_format_wl_to_fuchsia(format)
            .ok_or_else(|| format_err!("Invalid pixel format {:?}", format))?;
        let image_info = images::ImageInfo {
            width: width as u32,
            height: height as u32,
            stride: stride as u32,
            pixel_format: format,
            transform: images::Transform::Normal,
            color_space: images::ColorSpace::Srgb,
            tiling: images::Tiling::Linear,
            alpha_format: images::AlphaFormat::Opaque,
        };
        let this = this.get(client)?;
        Ok(Buffer::new(this.memory.clone(), offset, image_info))
    }
pub fn create_buffer ( this : ObjectRef < Self > , client : & mut Client , offset : u32 , width : i32 , height : i32 , stride : i32 , format : wl_shm :: Format , ) -> Result < Buffer , Error > { ftrace :: duration ! ( " " " " ) ; // TODO(tjdetwiler): Support sending the protocol-modeled errors, // ex: wl_shm::Error::InvalidFormat. let format = pixel_format_wl_to_fuchsia ( format ) . ok_or_else ( | | format_err ! ( " " format ) ) ? ; let image_info = images :: ImageInfo { width : width as u32 , height : height as u32 , stride : stride as u32 , pixel_format : format , transform : images :: Transform :: Normal , color_space : images :: ColorSpace :: Srgb , tiling : images :: Tiling :: Linear , alpha_format : images :: AlphaFormat :: Opaque , } ; let this = this . get ( client ) ? ; Ok ( Buffer :: new ( this . memory . clone ( ) , offset , image_info ) ) }
Creates a new wl_buffer object backed by memory from this wl_shm_pool.
Creates a new wl_buffer object backed by memory from this wl_shm_pool .
this
ObjectRef<Self>
client
&mut Client
offset
u32
width
i32
height
i32
stride
i32
format
wl_shm::Format
this
ObjectRef<Self>
client
&mut Client
offset
u32
width
i32
height
i32
stride
i32
format
wl_shm::Format