[cairo] [PATCH 4/6] matrix: Make the other *_rel_* routines non-relative internally

Bryce Harrington bryce at osg.samsung.com
Fri Nov 28 20:31:22 PST 2014


From: Bryce Harrington <b.harrington at samsung.com>

Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
---
 src/cairo-default-context.c |   46 ++++++++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/src/cairo-default-context.c b/src/cairo-default-context.c
index a751519..e4ceba4 100644
--- a/src/cairo-default-context.c
+++ b/src/cairo-default-context.c
@@ -792,8 +792,12 @@ _cairo_default_context_rel_move_to (void *abstract_cr, double dx, double dy)
 {
     cairo_default_context_t *cr = abstract_cr;
     cairo_fixed_t dx_fixed, dy_fixed;
+    double x, y;
 
-    _cairo_gstate_user_to_backend_distance (cr->gstate, &dx, &dy);
+    cairo_get_current_point ((cairo_t*)cr, &x, &y);
+    x += dx;
+    y += dy;
+    _cairo_gstate_user_to_backend (cr->gstate, &x, &y);
 
     dx_fixed = _cairo_fixed_from_double (dx);
     dy_fixed = _cairo_fixed_from_double (dy);
@@ -808,7 +812,7 @@ _cairo_default_context_rel_line_to (void *abstract_cr, double dx, double dy)
     cairo_fixed_t x_fixed, y_fixed;
     double x, y;
 
-    cairo_get_current_point (cr, &x, &y);
+    cairo_get_current_point ((cairo_t*)cr, &x, &y);
     x += dx;
     y += dy;
     _cairo_gstate_user_to_backend (cr->gstate, &x, &y);
@@ -827,27 +831,33 @@ _cairo_default_context_rel_curve_to (void *abstract_cr,
 				     double dx3, double dy3)
 {
     cairo_default_context_t *cr = abstract_cr;
-    cairo_fixed_t dx1_fixed, dy1_fixed;
-    cairo_fixed_t dx2_fixed, dy2_fixed;
-    cairo_fixed_t dx3_fixed, dy3_fixed;
+    cairo_fixed_t x1_fixed, y1_fixed;
+    cairo_fixed_t x2_fixed, y2_fixed;
+    cairo_fixed_t x3_fixed, y3_fixed;
+    double x, y;
+
+    cairo_get_current_point ((cairo_t*)cr, &x, &y);
+    dx1 += x;  dy1 += x;
+    dx2 += x;  dy2 += x;
+    dx3 += x;  dy3 += x;
 
-    _cairo_gstate_user_to_backend_distance (cr->gstate, &dx1, &dy1);
-    _cairo_gstate_user_to_backend_distance (cr->gstate, &dx2, &dy2);
-    _cairo_gstate_user_to_backend_distance (cr->gstate, &dx3, &dy3);
+    _cairo_gstate_user_to_backend (cr->gstate, &dx1, &dy1);
+    _cairo_gstate_user_to_backend (cr->gstate, &dx2, &dy2);
+    _cairo_gstate_user_to_backend (cr->gstate, &dx3, &dy3);
 
-    dx1_fixed = _cairo_fixed_from_double (dx1);
-    dy1_fixed = _cairo_fixed_from_double (dy1);
+    x1_fixed = _cairo_fixed_from_double (dx1);
+    y1_fixed = _cairo_fixed_from_double (dy1);
 
-    dx2_fixed = _cairo_fixed_from_double (dx2);
-    dy2_fixed = _cairo_fixed_from_double (dy2);
+    x2_fixed = _cairo_fixed_from_double (dx2);
+    y2_fixed = _cairo_fixed_from_double (dy2);
 
-    dx3_fixed = _cairo_fixed_from_double (dx3);
-    dy3_fixed = _cairo_fixed_from_double (dy3);
+    x3_fixed = _cairo_fixed_from_double (dx3);
+    y3_fixed = _cairo_fixed_from_double (dy3);
 
-    return _cairo_path_fixed_rel_curve_to (cr->path,
-					   dx1_fixed, dy1_fixed,
-					   dx2_fixed, dy2_fixed,
-					   dx3_fixed, dy3_fixed);
+    return _cairo_path_fixed_curve_to (cr->path,
+				       x1_fixed, y1_fixed,
+				       x2_fixed, y2_fixed,
+				       x3_fixed, y3_fixed);
 }
 
 static cairo_status_t
-- 
1.7.9.5



More information about the cairo mailing list