Remove lifetime parameter from CommandHandler
The wgpu backend no longer needs this.
This commit is contained in:
parent
3b209bd6aa
commit
172326005b
|
@ -500,7 +500,7 @@ impl RenderBackend for WebCanvasRenderBackend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CommandHandler<'a> for WebCanvasRenderBackend {
|
impl CommandHandler for WebCanvasRenderBackend {
|
||||||
fn render_bitmap(&mut self, bitmap: &BitmapHandle, transform: &Transform, smoothing: bool) {
|
fn render_bitmap(&mut self, bitmap: &BitmapHandle, transform: &Transform, smoothing: bool) {
|
||||||
if self.mask_state == MaskState::ClearMask {
|
if self.mask_state == MaskState::ClearMask {
|
||||||
return;
|
return;
|
||||||
|
@ -766,7 +766,7 @@ impl<'a> CommandHandler<'a> for WebCanvasRenderBackend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn blend(&mut self, commands: &'a CommandList, blend: BlendMode) {
|
fn blend(&mut self, commands: &CommandList, blend: BlendMode) {
|
||||||
self.push_blend_mode(blend);
|
self.push_blend_mode(blend);
|
||||||
commands.execute(self);
|
commands.execute(self);
|
||||||
self.pop_blend_mode();
|
self.pop_blend_mode();
|
||||||
|
|
|
@ -4,8 +4,8 @@ use crate::matrix::Matrix;
|
||||||
use crate::transform::Transform;
|
use crate::transform::Transform;
|
||||||
use swf::{BlendMode, Color};
|
use swf::{BlendMode, Color};
|
||||||
|
|
||||||
pub trait CommandHandler<'a> {
|
pub trait CommandHandler {
|
||||||
fn render_bitmap(&mut self, bitmap: &'a BitmapHandle, transform: &Transform, smoothing: bool);
|
fn render_bitmap(&mut self, bitmap: &BitmapHandle, transform: &Transform, smoothing: bool);
|
||||||
fn render_shape(&mut self, shape: ShapeHandle, transform: &Transform);
|
fn render_shape(&mut self, shape: ShapeHandle, transform: &Transform);
|
||||||
fn draw_rect(&mut self, color: Color, matrix: &Matrix);
|
fn draw_rect(&mut self, color: Color, matrix: &Matrix);
|
||||||
fn push_mask(&mut self);
|
fn push_mask(&mut self);
|
||||||
|
@ -13,7 +13,7 @@ pub trait CommandHandler<'a> {
|
||||||
fn deactivate_mask(&mut self);
|
fn deactivate_mask(&mut self);
|
||||||
fn pop_mask(&mut self);
|
fn pop_mask(&mut self);
|
||||||
|
|
||||||
fn blend(&mut self, commands: &'a CommandList, blend_mode: BlendMode);
|
fn blend(&mut self, commands: &CommandList, blend_mode: BlendMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
|
@ -26,7 +26,7 @@ impl CommandList {
|
||||||
Self::default()
|
Self::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute<'a>(&'a self, handler: &mut impl CommandHandler<'a>) {
|
pub fn execute(&self, handler: &mut impl CommandHandler) {
|
||||||
for command in &self.commands {
|
for command in &self.commands {
|
||||||
match command {
|
match command {
|
||||||
Command::RenderBitmap {
|
Command::RenderBitmap {
|
||||||
|
@ -48,8 +48,8 @@ impl CommandList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CommandHandler<'a> for CommandList {
|
impl CommandHandler for CommandList {
|
||||||
fn render_bitmap(&mut self, bitmap: &'a BitmapHandle, transform: &Transform, smoothing: bool) {
|
fn render_bitmap(&mut self, bitmap: &BitmapHandle, transform: &Transform, smoothing: bool) {
|
||||||
self.commands.push(Command::RenderBitmap {
|
self.commands.push(Command::RenderBitmap {
|
||||||
bitmap: bitmap.clone(),
|
bitmap: bitmap.clone(),
|
||||||
transform: transform.clone(),
|
transform: transform.clone(),
|
||||||
|
@ -87,7 +87,7 @@ impl<'a> CommandHandler<'a> for CommandList {
|
||||||
self.commands.push(Command::PopMask);
|
self.commands.push(Command::PopMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn blend(&mut self, commands: &'a CommandList, blend_mode: BlendMode) {
|
fn blend(&mut self, commands: &CommandList, blend_mode: BlendMode) {
|
||||||
self.commands
|
self.commands
|
||||||
.push(Command::Blend(commands.to_owned(), blend_mode));
|
.push(Command::Blend(commands.to_owned(), blend_mode));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1090,8 +1090,8 @@ impl RenderBackend for WebGlRenderBackend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CommandHandler<'a> for WebGlRenderBackend {
|
impl CommandHandler for WebGlRenderBackend {
|
||||||
fn render_bitmap(&mut self, bitmap: &'a BitmapHandle, transform: &Transform, smoothing: bool) {
|
fn render_bitmap(&mut self, bitmap: &BitmapHandle, transform: &Transform, smoothing: bool) {
|
||||||
self.set_stencil_state();
|
self.set_stencil_state();
|
||||||
let entry = as_registry_data(bitmap);
|
let entry = as_registry_data(bitmap);
|
||||||
// Adjust the quad draw to use the target bitmap.
|
// Adjust the quad draw to use the target bitmap.
|
||||||
|
@ -1417,7 +1417,7 @@ impl<'a> CommandHandler<'a> for WebGlRenderBackend {
|
||||||
self.mask_state_dirty = true;
|
self.mask_state_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn blend(&mut self, commands: &'a CommandList, blend: BlendMode) {
|
fn blend(&mut self, commands: &CommandList, blend: BlendMode) {
|
||||||
self.push_blend_mode(blend);
|
self.push_blend_mode(blend);
|
||||||
commands.execute(self);
|
commands.execute(self);
|
||||||
self.pop_blend_mode();
|
self.pop_blend_mode();
|
||||||
|
|
Loading…
Reference in New Issue