[librsvg: 7/12] shapes.rs: Make all the draw() functions the same
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 7/12] shapes.rs: Make all the draw() functions the same
- Date: Tue, 10 Dec 2019 19:45:07 +0000 (UTC)
commit 3f6d36a2929efa532d54ce524276c80f9695a9a4
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Dec 10 10:26:19 2019 -0600
shapes.rs: Make all the draw() functions the same
The only difference was the value of the render_markers field passed
to render_path_builder; now we have a uses_markers() function on each
node type to provide that value.
rsvg_internals/src/shapes.rs | 42 +++++++++++++++++++++++++++++++++++-------
1 file changed, 35 insertions(+), 7 deletions(-)
---
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index 16aba9fe..71bd48cb 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -140,7 +140,7 @@ impl NodeTrait for Path {
) -> Result<BoundingBox, RenderingError> {
let values = cascaded.get();
let builder = self.make_path_builder(values, draw_ctx);
- render_path_builder(&builder, draw_ctx, node, values, true, clipping)
+ render_path_builder(&builder, draw_ctx, node, values, self.uses_markers(), clipping)
}
}
@@ -152,6 +152,10 @@ impl Path {
) -> Cow<PathBuilder> {
Cow::Borrowed(&self.builder)
}
+
+ fn uses_markers(&self) -> bool {
+ true
+ }
}
#[derive(Debug, PartialEq)]
@@ -237,7 +241,7 @@ impl NodeTrait for Polygon {
) -> Result<BoundingBox, RenderingError> {
let values = cascaded.get();
let builder = self.make_path_builder(values, draw_ctx);
- render_path_builder(&builder, draw_ctx, node, values, true, clipping)
+ render_path_builder(&builder, draw_ctx, node, values, self.uses_markers(), clipping)
}
}
@@ -249,6 +253,10 @@ impl Polygon {
) -> Cow<PathBuilder> {
Cow::Owned(make_poly(self.points.as_ref(), true))
}
+
+ fn uses_markers(&self) -> bool {
+ true
+ }
}
#[derive(Default)]
@@ -276,7 +284,7 @@ impl NodeTrait for Polyline {
) -> Result<BoundingBox, RenderingError> {
let values = cascaded.get();
let builder = self.make_path_builder(values, draw_ctx);
- render_path_builder(&builder, draw_ctx, node, values, true, clipping)
+ render_path_builder(&builder, draw_ctx, node, values, self.uses_markers(), clipping)
}
}
@@ -288,6 +296,10 @@ impl Polyline {
) -> Cow<PathBuilder> {
Cow::Owned(make_poly(self.points.as_ref(), false))
}
+
+ fn uses_markers(&self) -> bool {
+ true
+ }
}
#[derive(Default)]
@@ -322,7 +334,7 @@ impl NodeTrait for Line {
) -> Result<BoundingBox, RenderingError> {
let values = cascaded.get();
let builder = self.make_path_builder(values, draw_ctx);
- render_path_builder(&builder, draw_ctx, node, values, true, clipping)
+ render_path_builder(&builder, draw_ctx, node, values, self.uses_markers(), clipping)
}
}
@@ -346,6 +358,10 @@ impl Line {
Cow::Owned(builder)
}
+
+ fn uses_markers(&self) -> bool {
+ true
+ }
}
#[derive(Default)]
@@ -398,7 +414,7 @@ impl NodeTrait for Rect {
) -> Result<BoundingBox, RenderingError> {
let values = cascaded.get();
let builder = self.make_path_builder(values, draw_ctx);
- render_path_builder(&builder, draw_ctx, node, values, false, clipping)
+ render_path_builder(&builder, draw_ctx, node, values, self.uses_markers(), clipping)
}
}
@@ -577,6 +593,10 @@ impl Rect {
Cow::Owned(builder)
}
+
+ fn uses_markers(&self) -> bool {
+ false
+ }
}
#[derive(Default)]
@@ -611,7 +631,7 @@ impl NodeTrait for Circle {
) -> Result<BoundingBox, RenderingError> {
let values = cascaded.get();
let builder = self.make_path_builder(values, draw_ctx);
- render_path_builder(&builder, draw_ctx, node, values, false, clipping)
+ render_path_builder(&builder, draw_ctx, node, values, self.uses_markers(), clipping)
}
}
@@ -629,6 +649,10 @@ impl Circle {
Cow::Owned(make_ellipse(cx, cy, r, r))
}
+
+ fn uses_markers(&self) -> bool {
+ false
+ }
}
#[derive(Default)]
@@ -667,7 +691,7 @@ impl NodeTrait for Ellipse {
) -> Result<BoundingBox, RenderingError> {
let values = cascaded.get();
let builder = self.make_path_builder(values, draw_ctx);
- render_path_builder(&builder, draw_ctx, node, values, false, clipping)
+ render_path_builder(&builder, draw_ctx, node, values, self.uses_markers(), clipping)
}
}
@@ -686,6 +710,10 @@ impl Ellipse {
Cow::Owned(make_ellipse(cx, cy, rx, ry))
}
+
+ fn uses_markers(&self) -> bool {
+ false
+ }
}
#[cfg(test)]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]