[librsvg: 9/15] impl BasicShape for Polygon and Polyline
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 9/15] impl BasicShape for Polygon and Polyline
- Date: Tue, 1 Dec 2020 22:17:53 +0000 (UTC)
commit b0edebec83afc7e3e54da0cee56dc69069bd8056
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Dec 1 14:58:57 2020 -0600
impl BasicShape for Polygon and Polyline
src/shapes.rs | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/shapes.rs b/src/shapes.rs
index 6f529109..e382e3fc 100644
--- a/src/shapes.rs
+++ b/src/shapes.rs
@@ -247,7 +247,7 @@ impl Draw for Polygon {
clipping: bool,
) -> Result<BoundingBox, RenderingError> {
let values = cascaded.get();
- Shape::new(Rc::new(make_poly(&self.points, true)), Markers::Yes).draw(
+ Shape::new(self.make_path(values, draw_ctx), Markers::Yes).draw(
node,
acquired_nodes,
values,
@@ -257,6 +257,12 @@ impl Draw for Polygon {
}
}
+impl BasicShape for Polygon {
+ fn make_path(&self, _values: &ComputedValues, _draw_ctx: &mut DrawingCtx) -> Rc<SvgPath> {
+ Rc::new(make_poly(&self.points, true))
+ }
+}
+
#[derive(Default)]
pub struct Polyline {
points: Points,
@@ -284,7 +290,7 @@ impl Draw for Polyline {
clipping: bool,
) -> Result<BoundingBox, RenderingError> {
let values = cascaded.get();
- Shape::new(Rc::new(make_poly(&self.points, false)), Markers::Yes).draw(
+ Shape::new(self.make_path(values, draw_ctx), Markers::Yes).draw(
node,
acquired_nodes,
values,
@@ -294,6 +300,12 @@ impl Draw for Polyline {
}
}
+impl BasicShape for Polyline {
+ fn make_path(&self, _values: &ComputedValues, _draw_ctx: &mut DrawingCtx) -> Rc<SvgPath> {
+ Rc::new(make_poly(&self.points, false))
+ }
+}
+
#[derive(Default)]
pub struct Line {
x1: Length<Horizontal>,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]