mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add surface methods to RenderingContext (#32933)
Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
This commit is contained in:
parent
45aa296b26
commit
4d49b04668
1 changed files with 16 additions and 0 deletions
|
@ -90,6 +90,22 @@ impl RenderingContext {
|
|||
Ok(RenderingContext(Rc::new(data)))
|
||||
}
|
||||
|
||||
pub fn create_surface(
|
||||
&self,
|
||||
surface_type: SurfaceType<NativeWidget>,
|
||||
) -> Result<Surface, Error> {
|
||||
let device = &mut self.0.device.borrow_mut();
|
||||
let context = &self.0.context.borrow();
|
||||
let surface_access = SurfaceAccess::GPUOnly;
|
||||
device.create_surface(&context, surface_access, surface_type)
|
||||
}
|
||||
|
||||
pub fn destroy_surface(&self, mut surface: Surface) -> Result<(), Error> {
|
||||
let device = &self.0.device.borrow();
|
||||
let context = &mut self.0.context.borrow_mut();
|
||||
device.destroy_surface(context, &mut surface)
|
||||
}
|
||||
|
||||
pub fn create_surface_texture(&self, surface: Surface) -> Result<SurfaceTexture, Error> {
|
||||
let device = &self.0.device.borrow();
|
||||
let context = &mut self.0.context.borrow_mut();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue