diff options
author | 2021-11-04 19:22:29 +0700 | |
---|---|---|
committer | 2021-11-04 19:24:11 +0700 | |
commit | 023aded2772f0cd6abd716fe5c8624d5d22e21fa (patch) | |
tree | 1bdb1a4584d7acc688b081a299bb4431cd35c349 /native/src/renderer | |
parent | 343f9b7e2e594bd1fef1ed511d71e81f9c44e3d9 (diff) | |
download | iced-023aded2772f0cd6abd716fe5c8624d5d22e21fa.tar.gz iced-023aded2772f0cd6abd716fe5c8624d5d22e21fa.tar.bz2 iced-023aded2772f0cd6abd716fe5c8624d5d22e21fa.zip |
Rename `fill_rectangle` to `fill_quad` in `Renderer`
Diffstat (limited to '')
-rw-r--r-- | native/src/renderer.rs | 9 | ||||
-rw-r--r-- | native/src/renderer/null.rs | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/native/src/renderer.rs b/native/src/renderer.rs index 1e518936..3b04a5c0 100644 --- a/native/src/renderer.rs +++ b/native/src/renderer.rs @@ -42,23 +42,28 @@ pub trait Renderer: Sized { element.layout(self, limits) } + /// Draws the primitives recorded in the given closure in a new layer. + /// + /// The layer will clip its contents to the provided `bounds`. fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self)); + /// Applies a `translation` to the primitives recorded in the given closure. fn with_translation( &mut self, translation: Vector, f: impl FnOnce(&mut Self), ); + /// Clears all of the recorded primitives in the [`Renderer`]. fn clear(&mut self); - fn fill_rectangle(&mut self, quad: Quad); + /// Fills a [`Quad`] with the provided [`Background`]. + fn fill_quad(&mut self, quad: Quad, background: impl Into<Background>); } #[derive(Debug, Clone, Copy, PartialEq)] pub struct Quad { pub bounds: Rectangle, - pub background: Background, pub border_radius: f32, pub border_width: f32, pub border_color: Color, diff --git a/native/src/renderer/null.rs b/native/src/renderer/null.rs index 263b38a9..a5b2f277 100644 --- a/native/src/renderer/null.rs +++ b/native/src/renderer/null.rs @@ -1,6 +1,6 @@ use crate::renderer::{self, Renderer}; use crate::text::{self, Text}; -use crate::{Font, Point, Rectangle, Size, Vector}; +use crate::{Background, Font, Point, Rectangle, Size, Vector}; /// A renderer that does nothing. /// @@ -27,7 +27,12 @@ impl Renderer for Null { fn clear(&mut self) {} - fn fill_rectangle(&mut self, _quad: renderer::Quad) {} + fn fill_quad( + &mut self, + _quad: renderer::Quad, + _background: impl Into<Background>, + ) { + } } impl text::Renderer for Null { |