subsurface: Add width/height methods to SubsuraceBuffer
This is potentially useful. Other properties are specific to shm/dmabuf, and not meaningful in general.
This commit is contained in:
parent
18f0521357
commit
c7dd111ae8
1 changed files with 14 additions and 0 deletions
|
|
@ -158,6 +158,20 @@ impl SubsurfaceBuffer {
|
|||
(subsurface_buffer, SubsurfaceBufferRelease(receiver))
|
||||
}
|
||||
|
||||
pub fn width(&self) -> i32 {
|
||||
match &*self.0.source {
|
||||
BufferSource::Dma(dma) => dma.width,
|
||||
BufferSource::Shm(shm) => shm.width,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn height(&self) -> i32 {
|
||||
match &*self.0.source {
|
||||
BufferSource::Dma(dma) => dma.height,
|
||||
BufferSource::Shm(shm) => shm.height,
|
||||
}
|
||||
}
|
||||
|
||||
// Behavior of `wl_buffer::released` is undefined if attached to multiple surfaces. To allow
|
||||
// things like that, create a new `wl_buffer` each time.
|
||||
fn create_buffer(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue