[librsvg/rustification] marker.rs: rename SegmentState states to something more meaningful



commit 9c93a2a3f9bb57263fee1f86a2a34275eb741c63
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Oct 26 19:22:30 2016 -0500

    marker.rs: rename SegmentState states to something more meaningful
    
    "Start" and "End" don't really say much about the state of processing
    the current subpath, which is the whole point of the state machine.
    Use NewSubpath and InSubpath instead.

 rust/src/marker.rs |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index c808854..9ef2512 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -17,8 +17,8 @@ pub enum Segment {
 }
 
 enum SegmentState {
-    Start,
-    End
+    NewSubpath,
+    InSubpath
 }
 
 /* This converts a cairo_path_t into a list of curveto-like segments.  Each segment can be:
@@ -93,7 +93,7 @@ pub fn path_to_segments (path: cairo::Path) -> Vec<Segment> {
     subpath_start_y = 0.0;
 
     segments = Vec::new ();
-    state = SegmentState::End;
+    state = SegmentState::InSubpath;
 
     for cairo_segment in path.iter () {
         last_x = cur_x;
@@ -113,7 +113,7 @@ pub fn path_to_segments (path: cairo::Path) -> Vec<Segment> {
                 subpath_start_x = cur_x;
                 subpath_start_y = cur_y;
 
-                state = SegmentState::Start;
+                state = SegmentState::NewSubpath;
             },
 
             cairo::PathSegment::LineTo ((x, y)) => {
@@ -123,12 +123,12 @@ pub fn path_to_segments (path: cairo::Path) -> Vec<Segment> {
                 seg = make_line (last_x, last_y, cur_x, cur_y);
 
                 match state {
-                    SegmentState::Start => {
-                        state = SegmentState::End;
+                    SegmentState::NewSubpath => {
+                        state = SegmentState::InSubpath;
                         needs_new_segment = false;
                     },
 
-                    SegmentState::End => {
+                    SegmentState::InSubpath => {
                         needs_new_segment = true;
                     }
                 }
@@ -141,12 +141,12 @@ pub fn path_to_segments (path: cairo::Path) -> Vec<Segment> {
                 seg = make_curve (last_x, last_y, x2, y2, x3, y3, cur_x, cur_y);
 
                 match state {
-                    SegmentState::Start => {
-                        state = SegmentState::End;
+                    SegmentState::NewSubpath => {
+                        state = SegmentState::InSubpath;
                         needs_new_segment = false;
                     },
 
-                    SegmentState::End => {
+                    SegmentState::InSubpath => {
                         needs_new_segment = true;
                     }
                 }
@@ -159,12 +159,12 @@ pub fn path_to_segments (path: cairo::Path) -> Vec<Segment> {
                 seg = make_line (last_x, last_y, cur_x, cur_y);
 
                 match state {
-                    SegmentState::Start => {
-                        state = SegmentState::End;
+                    SegmentState::NewSubpath => {
+                        state = SegmentState::InSubpath;
                         needs_new_segment = false;
                     },
 
-                    SegmentState::End => {
+                    SegmentState::InSubpath => {
                         needs_new_segment = true;
                     }
                 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]