From ff81fce7866be007bdf29f060243b5c6439bc801 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Fri, 21 Jan 2022 18:50:52 +0100 Subject: [PATCH] space: Pass a location to `RenderElement::draw` --- src/desktop/space/element.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/desktop/space/element.rs b/src/desktop/space/element.rs index d162060..b2294bc 100644 --- a/src/desktop/space/element.rs +++ b/src/desktop/space/element.rs @@ -44,6 +44,8 @@ where /// Draws the element using the provided `Frame` and `Renderer`. /// /// - `scale` provides the current fractional scale value to render as + /// - `location` refers to the relative position in the bound buffer the element should be drawn at, + /// so that it matches with the space-relative coordinates returned by [`RenderElement::geometry`]. /// - `damage` provides the regions you need to re-draw and *may* not /// be equivalent to the damage returned by `accumulated_damage`. /// Redrawing other parts of the element is not valid and may cause rendering artifacts. @@ -52,6 +54,7 @@ where renderer: &mut R, frame: &mut F, scale: f64, + location: Point, damage: &[Rectangle], log: &slog::Logger, ) -> Result<(), R::Error>; @@ -109,11 +112,11 @@ where renderer: &mut R, frame: &mut F, scale: f64, - _location: Point, + location: Point, damage: &[Rectangle], log: &slog::Logger, ) -> Result<(), R::Error> { - (&**self as &dyn RenderElement).draw(renderer, frame, scale, damage, log) + (&**self as &dyn RenderElement).draw(renderer, frame, scale, location, damage, log) } } @@ -162,6 +165,7 @@ where renderer: &mut R, frame: &mut F, scale: f64, + location: Point, damage: &[Rectangle], log: &slog::Logger, ) -> Result<(), R::Error> { @@ -170,7 +174,7 @@ where frame, &self.surface, scale, - self.position, + location, damage, log, )