summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-08-26 15:44:32 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-08-26 15:44:32 +0700
commit59b3d724edd171c3439c8996a186e53795e51fa5 (patch)
tree17a83759ebae324f96a0ffe533104cd43fa171a3 /graphics
parent82d967c04f3b928cd8977d5665a4773e8a7b2587 (diff)
downloadiced-59b3d724edd171c3439c8996a186e53795e51fa5.tar.gz
iced-59b3d724edd171c3439c8996a186e53795e51fa5.tar.bz2
iced-59b3d724edd171c3439c8996a186e53795e51fa5.zip
Use `FillTessellator::tessellate_rectangle` in `Frame`
Diffstat (limited to 'graphics')
-rw-r--r--graphics/src/widget/canvas/frame.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/graphics/src/widget/canvas/frame.rs b/graphics/src/widget/canvas/frame.rs
index 2eaa2274..4873e7fb 100644
--- a/graphics/src/widget/canvas/frame.rs
+++ b/graphics/src/widget/canvas/frame.rs
@@ -118,8 +118,6 @@ impl Frame {
size: Size,
fill: impl Into<Fill>,
) {
- use lyon::path::builder::PathBuilder;
-
let Fill { color, rule } = fill.into();
let mut buffers = tessellation::BuffersBuilder::new(
@@ -140,14 +138,14 @@ impl Frame {
let options =
tessellation::FillOptions::default().with_fill_rule(rule.into());
- let mut builder = self.fill_tessellator.builder(&options, &mut buffers);
-
- builder.add_rectangle(
- &lyon::math::Rect::new(top_left, size.into()),
- lyon::path::Winding::Positive,
- );
-
- let _ = builder.build().expect("Fill rectangle");
+ let _ = self
+ .fill_tessellator
+ .tessellate_rectangle(
+ &lyon::math::Rect::new(top_left, size.into()),
+ &options,
+ &mut buffers,
+ )
+ .expect("Fill rectangle");
}
/// Draws the stroke of the given [`Path`] on the [`Frame`] with the