space: Pass a location to `RenderElement::draw`

This commit is contained in:
Victoria Brekenfeld 2022-01-21 18:50:52 +01:00
parent e019b4fa9e
commit ff81fce786
1 changed files with 7 additions and 3 deletions

View File

@ -44,6 +44,8 @@ where
/// Draws the element using the provided `Frame` and `Renderer`. /// Draws the element using the provided `Frame` and `Renderer`.
/// ///
/// - `scale` provides the current fractional scale value to render as /// - `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 /// - `damage` provides the regions you need to re-draw and *may* not
/// be equivalent to the damage returned by `accumulated_damage`. /// be equivalent to the damage returned by `accumulated_damage`.
/// Redrawing other parts of the element is not valid and may cause rendering artifacts. /// Redrawing other parts of the element is not valid and may cause rendering artifacts.
@ -52,6 +54,7 @@ where
renderer: &mut R, renderer: &mut R,
frame: &mut F, frame: &mut F,
scale: f64, scale: f64,
location: Point<i32, Logical>,
damage: &[Rectangle<i32, Logical>], damage: &[Rectangle<i32, Logical>],
log: &slog::Logger, log: &slog::Logger,
) -> Result<(), R::Error>; ) -> Result<(), R::Error>;
@ -109,11 +112,11 @@ where
renderer: &mut R, renderer: &mut R,
frame: &mut F, frame: &mut F,
scale: f64, scale: f64,
_location: Point<i32, Logical>, location: Point<i32, Logical>,
damage: &[Rectangle<i32, Logical>], damage: &[Rectangle<i32, Logical>],
log: &slog::Logger, log: &slog::Logger,
) -> Result<(), R::Error> { ) -> Result<(), R::Error> {
(&**self as &dyn RenderElement<R, F, E, T>).draw(renderer, frame, scale, damage, log) (&**self as &dyn RenderElement<R, F, E, T>).draw(renderer, frame, scale, location, damage, log)
} }
} }
@ -162,6 +165,7 @@ where
renderer: &mut R, renderer: &mut R,
frame: &mut F, frame: &mut F,
scale: f64, scale: f64,
location: Point<i32, Logical>,
damage: &[Rectangle<i32, Logical>], damage: &[Rectangle<i32, Logical>],
log: &slog::Logger, log: &slog::Logger,
) -> Result<(), R::Error> { ) -> Result<(), R::Error> {
@ -170,7 +174,7 @@ where
frame, frame,
&self.surface, &self.surface,
scale, scale,
self.position, location,
damage, damage,
log, log,
) )