it: use single-pixel buffer instead of shm
This commit is contained in:
parent
aaed003ec8
commit
f562f887f0
17 changed files with 280 additions and 76 deletions
52
src/it/test_ifs/test_viewport.rs
Normal file
52
src/it/test_ifs/test_viewport.rs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
use {
|
||||
crate::{
|
||||
fixed::Fixed,
|
||||
it::{test_error::TestError, test_object::TestObject, test_transport::TestTransport},
|
||||
wire::{wp_viewport::*, WpViewportId},
|
||||
},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
pub struct TestViewport {
|
||||
pub id: WpViewportId,
|
||||
pub tran: Rc<TestTransport>,
|
||||
}
|
||||
|
||||
impl TestViewport {
|
||||
pub fn destroy(&self) -> Result<(), TestError> {
|
||||
self.tran.send(Destroy { self_id: self.id })?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_source(&self, x: i32, y: i32, width: i32, height: i32) -> Result<(), TestError> {
|
||||
self.tran.send(SetSource {
|
||||
self_id: self.id,
|
||||
x: Fixed::from_int(x),
|
||||
y: Fixed::from_int(y),
|
||||
width: Fixed::from_int(width),
|
||||
height: Fixed::from_int(height),
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_destination(&self, width: i32, height: i32) -> Result<(), TestError> {
|
||||
self.tran.send(SetDestination {
|
||||
self_id: self.id,
|
||||
width: width.max(1),
|
||||
height: height.max(1),
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TestViewport {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
test_object! {
|
||||
TestViewport, WpViewport;
|
||||
}
|
||||
|
||||
impl TestObject for TestViewport {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue