From 9c63eb7df559e58b14188b4096e9bd206444bbf3 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 26 Apr 2023 16:46:27 +0200 Subject: Update `tiny-skia` and `resvg` --- tiny_skia/src/window/compositor.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tiny_skia/src/window/compositor.rs') diff --git a/tiny_skia/src/window/compositor.rs b/tiny_skia/src/window/compositor.rs index 6e4bb6ef..7523e06f 100644 --- a/tiny_skia/src/window/compositor.rs +++ b/tiny_skia/src/window/compositor.rs @@ -7,13 +7,13 @@ use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle}; use std::marker::PhantomData; pub struct Compositor { - clip_mask: tiny_skia::ClipMask, _theme: PhantomData, } pub struct Surface { window: softbuffer::GraphicsContext, buffer: Vec, + clip_mask: tiny_skia::Mask, } impl crate::graphics::Compositor for Compositor { @@ -43,6 +43,8 @@ impl crate::graphics::Compositor for Compositor { Surface { window, buffer: vec![0; width as usize * height as usize], + clip_mask: tiny_skia::Mask::new(width, height) + .expect("Create clip mask"), } } @@ -53,6 +55,8 @@ impl crate::graphics::Compositor for Compositor { height: u32, ) { surface.buffer.resize((width * height) as usize, 0); + surface.clip_mask = + tiny_skia::Mask::new(width, height).expect("Create clip mask"); } fn fetch_information(&self) -> Information { @@ -72,7 +76,6 @@ impl crate::graphics::Compositor for Compositor { ) -> Result<(), SurfaceError> { renderer.with_primitives(|backend, primitives| { present( - self, backend, surface, primitives, @@ -85,18 +88,15 @@ impl crate::graphics::Compositor for Compositor { } pub fn new(settings: Settings) -> (Compositor, Backend) { - // TOD ( Compositor { - clip_mask: tiny_skia::ClipMask::new(), _theme: PhantomData, }, Backend::new(settings), ) } -pub fn present>( - compositor: &mut Compositor, +pub fn present>( backend: &mut Backend, surface: &mut Surface, primitives: &[Primitive], @@ -113,7 +113,7 @@ pub fn present>( physical_size.height, ) .expect("Create pixel map"), - &mut compositor.clip_mask, + &mut surface.clip_mask, primitives, viewport, background_color, -- cgit