[librsvg/rustification] path_parser.rs: Put unimplemented stubs for the all the remaining drawing functions
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/rustification] path_parser.rs: Put unimplemented stubs for the all the remaining drawing functions
- Date: Tue, 8 Nov 2016 22:05:17 +0000 (UTC)
commit a4fb81c64e1e9a439fb0585e55abb5110e5b6789
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Nov 7 14:43:47 2016 -0600
path_parser.rs: Put unimplemented stubs for the all the remaining drawing functions
Also, fix the test that was failing; it was an error in the test.
rust/src/path_parser.rs | 65 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 63 insertions(+), 2 deletions(-)
---
diff --git a/rust/src/path_parser.rs b/rust/src/path_parser.rs
index 81ee1ad..5f5fce3 100644
--- a/rust/src/path_parser.rs
+++ b/rust/src/path_parser.rs
@@ -348,7 +348,7 @@ impl<'external> PathParser<'external> {
fn moveto_drawto_command_group (&mut self, is_initial_moveto: bool) -> bool {
if self.moveto (is_initial_moveto) {
return self.optional_whitespace () &&
- { println! ("w00p"); true }; // FIXME self.optional_drawto_commands ();
+ self.optional_drawto_commands ();
} else {
false
}
@@ -368,6 +368,67 @@ impl<'external> PathParser<'external> {
self.error ("Expected moveto command")
}
}
+
+ fn optional_drawto_commands (&mut self) -> bool {
+ if self.drawto_command () {
+ loop {
+ self.optional_whitespace ();
+ if !self.optional_drawto_commands () {
+ break;
+ }
+ }
+ }
+
+ true
+ }
+
+ fn drawto_command (&mut self) -> bool {
+ return self.close_path () ||
+ self.line_to () ||
+ self.horizontal_line_to () ||
+ self.vertical_line_to () ||
+ self.curve_to () ||
+ self.smooth_curve_to () ||
+ self.quadratic_bezier_curve_to () ||
+ self.smooth_quadratic_bezier_curve_to () ||
+ self.elliptical_arc ();
+ }
+
+ fn close_path (&mut self) -> bool {
+ false
+ }
+
+ fn line_to (&mut self) -> bool {
+ false
+ }
+
+ fn horizontal_line_to (&mut self) -> bool {
+ false
+ }
+
+ fn vertical_line_to (&mut self) -> bool {
+ false
+ }
+
+ fn curve_to (&mut self) -> bool {
+ false
+ }
+
+ fn smooth_curve_to (&mut self) -> bool {
+ false
+ }
+
+ fn quadratic_bezier_curve_to (&mut self) -> bool {
+ false
+ }
+
+ fn smooth_quadratic_bezier_curve_to (&mut self) -> bool {
+ false
+ }
+
+ fn elliptical_arc (&mut self) -> bool {
+ false
+ }
}
fn char_to_digit (c: char) -> i32 {
@@ -714,7 +775,7 @@ mod tests {
&vec![
moveto (10.0, 20.0),
lineto (40.0, 60.0),
- moveto (80.0, 120.0)
+ moveto (90.0, 120.0)
]);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]