1
0
Fork 0
forked from wry/wry

render: move take_render_ops to GfxFramebuffer

This commit is contained in:
Julian Orth 2023-10-23 20:04:57 +02:00
parent 074347c71d
commit 5778c49679
3 changed files with 8 additions and 8 deletions

View file

@ -113,6 +113,8 @@ pub enum ResetStatus {
pub trait GfxFramebuffer: Debug { pub trait GfxFramebuffer: Debug {
fn as_any(&self) -> &dyn Any; fn as_any(&self) -> &dyn Any;
fn take_render_ops(&self) -> Vec<GfxApiOpt>;
fn clear(&self); fn clear(&self);
fn clear_with(&self, r: f32, g: f32, b: f32, a: f32); fn clear_with(&self, r: f32, g: f32, b: f32, a: f32);
@ -167,8 +169,6 @@ pub trait GfxTexture: Debug {
} }
pub trait GfxContext: Debug { pub trait GfxContext: Debug {
fn take_render_ops(&self) -> Vec<GfxApiOpt>;
fn reset_status(&self) -> Option<ResetStatus>; fn reset_status(&self) -> Option<ResetStatus>;
fn supports_external_texture(&self) -> bool; fn supports_external_texture(&self) -> bool;

View file

@ -25,7 +25,6 @@ use {
cell::{Cell, RefCell}, cell::{Cell, RefCell},
ffi::CString, ffi::CString,
fmt::{Debug, Formatter}, fmt::{Debug, Formatter},
mem,
rc::Rc, rc::Rc,
}, },
uapi::ustr, uapi::ustr,
@ -203,10 +202,6 @@ impl GlRenderContext {
} }
impl GfxContext for GlRenderContext { impl GfxContext for GlRenderContext {
fn take_render_ops(&self) -> Vec<GfxApiOpt> {
mem::take(&mut self.gfx_ops.borrow_mut())
}
fn reset_status(&self) -> Option<ResetStatus> { fn reset_status(&self) -> Option<ResetStatus> {
self.reset_status() self.reset_status()
} }

View file

@ -3,7 +3,7 @@ use {
cursor::Cursor, cursor::Cursor,
fixed::Fixed, fixed::Fixed,
format::{Format, ARGB8888, XRGB8888}, format::{Format, ARGB8888, XRGB8888},
gfx_api::{GfxFramebuffer, GfxTexture}, gfx_api::{GfxApiOpt, GfxFramebuffer, GfxTexture},
gfx_apis::gl::{ gfx_apis::gl::{
gl::{ gl::{
frame_buffer::GlFrameBuffer, frame_buffer::GlFrameBuffer,
@ -26,6 +26,7 @@ use {
any::Any, any::Any,
cell::Cell, cell::Cell,
fmt::{Debug, Formatter}, fmt::{Debug, Formatter},
mem,
rc::Rc, rc::Rc,
}, },
}; };
@ -263,6 +264,10 @@ impl GfxFramebuffer for Framebuffer {
self self
} }
fn take_render_ops(&self) -> Vec<GfxApiOpt> {
mem::take(&mut self.ctx.gfx_ops.borrow_mut())
}
fn clear(&self) { fn clear(&self) {
self.clear() self.clear()
} }