Skip to content

Commit 60e72fe

Browse files
wusyongGae24
authored andcommitted
Add surface methods to RenderingContext (servo#32933)
Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
1 parent 2e26bb1 commit 60e72fe

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

components/shared/webrender/rendering_context.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,22 @@ impl RenderingContext {
9090
Ok(RenderingContext(Rc::new(data)))
9191
}
9292

93+
pub fn create_surface(
94+
&self,
95+
surface_type: SurfaceType<NativeWidget>,
96+
) -> Result<Surface, Error> {
97+
let device = &mut self.0.device.borrow_mut();
98+
let context = &self.0.context.borrow();
99+
let surface_access = SurfaceAccess::GPUOnly;
100+
device.create_surface(&context, surface_access, surface_type)
101+
}
102+
103+
pub fn destroy_surface(&self, mut surface: Surface) -> Result<(), Error> {
104+
let device = &self.0.device.borrow();
105+
let context = &mut self.0.context.borrow_mut();
106+
device.destroy_surface(context, &mut surface)
107+
}
108+
93109
pub fn create_surface_texture(&self, surface: Surface) -> Result<SurfaceTexture, Error> {
94110
let device = &self.0.device.borrow();
95111
let context = &mut self.0.context.borrow_mut();

0 commit comments

Comments
 (0)