Introduce with_transformation to Renderer trait

This commit is contained in:
Héctor Ramón Jiménez 2023-10-24 05:34:03 +02:00
parent a6e91d13d5
commit f4d6648601
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
31 changed files with 161 additions and 118 deletions

View file

@ -7,7 +7,6 @@ pub use event::Event;
pub use program::Program;
pub use crate::graphics::geometry::*;
pub use crate::graphics::Transformation;
pub use crate::renderer::geometry::*;
use crate::core;
@ -16,7 +15,7 @@ use crate::core::mouse;
use crate::core::renderer;
use crate::core::widget::tree::{self, Tree};
use crate::core::{
Clipboard, Element, Length, Rectangle, Shell, Size, Vector, Widget,
Clipboard, Element, Length, Rectangle, Shell, Size, Transformation, Widget,
};
use crate::graphics::geometry;
@ -208,8 +207,8 @@ where
let state = tree.state.downcast_ref::<P::State>();
renderer.with_translation(
Vector::new(bounds.x, bounds.y),
renderer.with_transformation(
Transformation::translate(bounds.x, bounds.y),
|renderer| {
renderer.draw(
self.program.draw(state, renderer, theme, bounds, cursor),