1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use super::server::ServerObjectId;
use super::{CompositionObject, Compositor, ICompositionObject};
use std::any::Any;
use std::rc::Rc;
/// A surface that a surface visual shows. The server-side counterpart
/// provides the bitmap.
pub struct CompositionSurface {
object: CompositionObject,
}
impl CompositionSurface {
/// Creates the UI-thread side of a surface whose server side is the
/// object with the given id.
pub fn new(compositor: &Rc<Compositor>, server: ServerObjectId) -> Rc<CompositionSurface> {
Rc::new(CompositionSurface { object: CompositionObject::new(compositor, Some(server)) })
}
pub fn compositor(&self) -> &Rc<Compositor> {
self.object.compositor()
}
pub fn is_disposed(&self) -> bool {
self.object.is_disposed()
}
pub fn dispose(&self) {
self.object.dispose();
}
}
impl ICompositionObject for CompositionSurface {
fn server(&self) -> ServerObjectId {
self.object.required_server()
}
fn as_any(&self) -> &dyn Any {
self
}
fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any> {
self
}
}