[librsvg: 2/15] shapes - move the make_path functions to a BasicShape trait
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/15] shapes - move the make_path functions to a BasicShape trait
- Date: Tue, 1 Dec 2020 22:17:53 +0000 (UTC)
commit 46c9dd119a08a389703c4f015ae279688f766025
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Dec 1 14:11:26 2020 -0600
shapes - move the make_path functions to a BasicShape trait
src/shapes.rs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/shapes.rs b/src/shapes.rs
index 61bd9e95..89cb012b 100644
--- a/src/shapes.rs
+++ b/src/shapes.rs
@@ -54,6 +54,10 @@ impl Shape {
}
}
+trait BasicShape {
+ fn make_path(&self, values: &ComputedValues, draw_ctx: &mut DrawingCtx) -> SvgPath;
+}
+
fn make_ellipse(cx: f64, cy: f64, rx: f64, ry: f64) -> SvgPath {
let mut builder = PathBuilder::default();
@@ -332,7 +336,7 @@ impl Draw for Line {
}
}
-impl Line {
+impl BasicShape for Line {
fn make_path(&self, values: &ComputedValues, draw_ctx: &mut DrawingCtx) -> SvgPath {
let mut builder = PathBuilder::default();
@@ -414,7 +418,7 @@ impl Draw for Rect {
}
}
-impl Rect {
+impl BasicShape for Rect {
fn make_path(&self, values: &ComputedValues, draw_ctx: &mut DrawingCtx) -> SvgPath {
let params = draw_ctx.get_view_params();
@@ -631,7 +635,7 @@ impl Draw for Circle {
}
}
-impl Circle {
+impl BasicShape for Circle {
fn make_path(&self, values: &ComputedValues, draw_ctx: &mut DrawingCtx) -> SvgPath {
let params = draw_ctx.get_view_params();
@@ -693,7 +697,7 @@ impl Draw for Ellipse {
}
}
-impl Ellipse {
+impl BasicShape for Ellipse {
fn make_path(&self, values: &ComputedValues, draw_ctx: &mut DrawingCtx) -> SvgPath {
let params = draw_ctx.get_view_params();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]