[cairo-commit] cairo/src cairo.h,1.43,1.44 cairo_fixed.c,1.2,1.3 cairo_ft_font.c,1.17,1.18 cairo_gstate.c,1.40,1.41 cairo_path.c,1.12,1.13 cairo_path_bounds.c,1.9,1.10 cairo_path_fill.c,1.8,1.9 cairo_path_stroke.c,1.14,1.15 cairo_traps.c,1.13,1.14 cairoint.h,1.50,1.51

Carl Worth commit at pdx.freedesktop.org
Mon Aug 15 11:12:59 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory pdx:/tmp/cvs-serv25206/src

Modified Files:
	cairo.h cairo_fixed.c cairo_ft_font.c cairo_gstate.c 
	cairo_path.c cairo_path_bounds.c cairo_path_fill.c 
	cairo_path_stroke.c cairo_traps.c cairoint.h 
Log Message:

        * src/cairo.h: Add typedefs for new callbacks to be used by
        cairo_current_path: cairo_move_to_func, cairo_line_to_func,
        cairo_curve_to_func, and cairo_close_path_func.

        * src/cairoint.h: cairo_path.last_move_point and
        cairo_path.current_point are now fixed-point not doubles for
        consistency.

        * src/cairo_path.c (_cairo_path_interpret): Now accept 4 explicit
        function pointers rather than a structure. Eliminate unnecessary
        done_path callback.

        * src/cairo_path_bounds.c (_cairo_path_bounds):
        * src/cairo_path_stroke.c (_cairo_path_stroke_to_traps):
        * src/cairo_path_fill.c (_cairo_path_fill_to_traps): Track change
        in _cairo_path_interpret. Code previously in done_path callback is
        now here immediately after call to _cairo_path_interpret.

        * src/cairo_path.c (_cairo_path_move_to):
        (_cairo_path_rel_move_to):
        (_cairo_path_line_to):
        (_cairo_path_rel_line_to):
        (_cairo_path_curve_to):
        (_cairo_path_rel_curve_to):
        (_cairo_path_current_point): Internal _cairo_path API modified to
        accept fixed-point data everywhere. Much cleaner this way.

        * src/cairo_gstate.c (_cairo_gstate_move_to):
        (_cairo_gstate_line_to):
        (_cairo_gstate_curve_to):
        (_cairo_gstate_rel_move_to):
        (_cairo_gstate_rel_line_to):
        (_cairo_gstate_rel_curve_to):
        (_cairo_gstate_current_point):
        (_cairo_gstate_show_text):
        (_cairo_gstate_text_path): Have to convert doubles to fixed-point
        to track changes in _cairo_path API.

        * src/cairo_ft_font.c (_move_to, _line_to, _conic_to, _cubic_to):
        Keep data in fixed-point rather than going through intermediate
        doubles. Track changes in _cairo_path API.

        * src/cairo_fixed.c (_cairo_fixed_from_26_6): New function to help
        when working with freetype.


Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** cairo.h	3 Feb 2004 07:24:14 -0000	1.43
--- cairo.h	13 Feb 2004 03:02:33 -0000	1.44
***************
*** 524,527 ****
--- 524,540 ----
  cairo_current_target_surface (cairo_t *cr);
  
+ typedef void (cairo_move_to_func_t) (void *closure,
+ 				     double x, double y);
+ 
+ typedef void (cairo_line_to_func_t) (void *closure,
+ 				     double x, double y);
+ 
+ typedef void (cairo_curve_to_func_t) (void *closure,
+ 				      double x1, double y1,
+ 				      double x2, double y2,
+ 				      double x3, double y3);
+ 
+ typedef void (cairo_close_path_func_t) (void *closure);
+ 
  /* Error status queries */
  

Index: cairo_fixed.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_fixed.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** cairo_fixed.c	23 Oct 2003 14:47:29 -0000	1.2
--- cairo_fixed.c	13 Feb 2004 03:02:33 -0000	1.3
***************
*** 40,43 ****
--- 40,49 ----
  }
  
+ cairo_fixed_t
+ _cairo_fixed_from_26_6 (uint32_t i)
+ {
+     return i << 10;
+ }
+ 
  double
  _cairo_fixed_to_double (cairo_fixed_t f)
***************
*** 45,46 ****
--- 51,53 ----
      return ((double) f) / 65536.0;
  }
+ 

Index: cairo_ft_font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_ft_font.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** cairo_ft_font.c	16 Dec 2003 15:20:20 -0000	1.17
--- cairo_ft_font.c	13 Feb 2004 03:02:33 -0000	1.18
***************
*** 594,602 ****
  {
      cairo_path_t *path = closure;
  
      _cairo_path_close_path (path);
!     _cairo_path_move_to (path,
! 			 DOUBLE_FROM_26_6(to->x),
! 			 DOUBLE_FROM_26_6(to->y));
  
      return 0;
--- 594,604 ----
  {
      cairo_path_t *path = closure;
+     cairo_point_t point;
+ 
+     point.x = _cairo_fixed_from_26_6 (to->x);
+     point.y = _cairo_fixed_from_26_6 (to->y);
  
      _cairo_path_close_path (path);
!     _cairo_path_move_to (path, &point);
  
      return 0;
***************
*** 607,614 ****
  {
      cairo_path_t *path = closure;
  
!     _cairo_path_line_to (path,
! 			 DOUBLE_FROM_26_6(to->x),
! 			 DOUBLE_FROM_26_6(to->y));
  
      return 0;
--- 609,618 ----
  {
      cairo_path_t *path = closure;
+     cairo_point_t point;
  
!     point.x = _cairo_fixed_from_26_6 (to->x);
!     point.y = _cairo_fixed_from_26_6 (to->y);
! 
!     _cairo_path_line_to (path, &point);
  
      return 0;
***************
*** 620,635 ****
      cairo_path_t *path = closure;
  
!     double x1, y1;
!     double x2 = DOUBLE_FROM_26_6(control->x);
!     double y2 = DOUBLE_FROM_26_6(control->y);
!     double x3 = DOUBLE_FROM_26_6(to->x);
!     double y3 = DOUBLE_FROM_26_6(to->y);
  
!     _cairo_path_current_point (path, &x1, &y1);
  
      _cairo_path_curve_to (path,
! 			  x1 + 2.0/3.0 * (x2 - x1), y1 + 2.0/3.0 * (y2 - y1),
! 			  x3 + 2.0/3.0 * (x2 - x3), y3 + 2.0/3.0 * (y2 - y3),
! 			  x3, y3);
  
      return 0;
--- 624,646 ----
      cairo_path_t *path = closure;
  
!     cairo_point_t p0, p1, p2, p3;
!     cairo_point_t conic;
  
!     _cairo_path_current_point (path, &p0);
! 
!     conic.x = _cairo_fixed_from_26_6 (control->x);
!     conic.y = _cairo_fixed_from_26_6 (control->y);
! 
!     p3.x = _cairo_fixed_from_26_6 (to->x);
!     p3.y = _cairo_fixed_from_26_6 (to->y);
! 
!     p1.x = p0.x + 2.0/3.0 * (conic.x - p0.x);
!     p1.y = p0.y + 2.0/3.0 * (conic.y - p0.y);
! 
!     p2.x = p3.x + 2.0/3.0 * (conic.x - p3.x);
!     p2.y = p3.y + 2.0/3.0 * (conic.y - p3.y);
  
      _cairo_path_curve_to (path,
! 			  &p1, &p2, &p3);
  
      return 0;
***************
*** 640,648 ****
  {
      cairo_path_t *path = closure;
  
!     _cairo_path_curve_to (path, 
! 			  DOUBLE_FROM_26_6(control1->x), DOUBLE_FROM_26_6(control1->y),
! 			  DOUBLE_FROM_26_6(control2->x), DOUBLE_FROM_26_6(control2->y),
! 			  DOUBLE_FROM_26_6(to->x), DOUBLE_FROM_26_6(to->y));
  
      return 0;
--- 651,666 ----
  {
      cairo_path_t *path = closure;
+     cairo_point_t p0, p1, p2;
  
!     p0.x = _cairo_fixed_from_26_6 (control1->x);
!     p0.y = _cairo_fixed_from_26_6 (control1->y);
! 
!     p1.x = _cairo_fixed_from_26_6 (control2->x);
!     p1.y = _cairo_fixed_from_26_6 (control2->y);
! 
!     p2.x = _cairo_fixed_from_26_6 (to->x);
!     p2.y = _cairo_fixed_from_26_6 (to->y);
! 
!     _cairo_path_curve_to (path, &p0, &p1, &p2);
  
      return 0;

Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** cairo_gstate.c	16 Dec 2003 15:20:20 -0000	1.40
--- cairo_gstate.c	13 Feb 2004 03:02:33 -0000	1.41
***************
*** 685,691 ****
  _cairo_gstate_move_to (cairo_gstate_t *gstate, double x, double y)
  {
      cairo_matrix_transform_point (&gstate->ctm, &x, &y);
  
!     return _cairo_path_move_to (&gstate->path, x, y);
  }
  
--- 685,696 ----
  _cairo_gstate_move_to (cairo_gstate_t *gstate, double x, double y)
  {
+     cairo_point_t point;
+ 
      cairo_matrix_transform_point (&gstate->ctm, &x, &y);
  
!     point.x = _cairo_fixed_from_double (x);
!     point.y = _cairo_fixed_from_double (y);
! 
!     return _cairo_path_move_to (&gstate->path, &point);
  }
  
***************
*** 693,715 ****
  _cairo_gstate_line_to (cairo_gstate_t *gstate, double x, double y)
  {
      cairo_matrix_transform_point (&gstate->ctm, &x, &y);
  
!     return _cairo_path_line_to (&gstate->path, x, y);
  }
  
  cairo_status_t
  _cairo_gstate_curve_to (cairo_gstate_t *gstate,
  			double x1, double y1,
! 			double x2, double y2,
! 			double x3, double y3)
  {
      cairo_matrix_transform_point (&gstate->ctm, &x1, &y1);
      cairo_matrix_transform_point (&gstate->ctm, &x2, &y2);
-     cairo_matrix_transform_point (&gstate->ctm, &x3, &y3);
  
!     return _cairo_path_curve_to (&gstate->path,
! 				 x1, y1,
! 				 x2, y2,
! 				 x3, y3);
  }
  
--- 698,733 ----
  _cairo_gstate_line_to (cairo_gstate_t *gstate, double x, double y)
  {
+     cairo_point_t point;
+ 
      cairo_matrix_transform_point (&gstate->ctm, &x, &y);
  
!     point.x = _cairo_fixed_from_double (x);
!     point.y = _cairo_fixed_from_double (y);
! 
!     return _cairo_path_line_to (&gstate->path, &point);
  }
  
  cairo_status_t
  _cairo_gstate_curve_to (cairo_gstate_t *gstate,
+ 			double x0, double y0,
  			double x1, double y1,
! 			double x2, double y2)
  {
+     cairo_point_t p0, p1, p2;
+ 
+     cairo_matrix_transform_point (&gstate->ctm, &x0, &y0);
      cairo_matrix_transform_point (&gstate->ctm, &x1, &y1);
      cairo_matrix_transform_point (&gstate->ctm, &x2, &y2);
  
!     p0.x = _cairo_fixed_from_double (x0);
!     p0.y = _cairo_fixed_from_double (y0);
! 
!     p1.x = _cairo_fixed_from_double (x1);
!     p1.y = _cairo_fixed_from_double (y1);
! 
!     p2.x = _cairo_fixed_from_double (x2);
!     p2.y = _cairo_fixed_from_double (y2);
! 
!     return _cairo_path_curve_to (&gstate->path, &p0, &p1, &p2);
  }
  
***************
*** 989,995 ****
  _cairo_gstate_rel_move_to (cairo_gstate_t *gstate, double dx, double dy)
  {
      cairo_matrix_transform_distance (&gstate->ctm, &dx, &dy);
  
!     return _cairo_path_rel_move_to (&gstate->path, dx, dy);
  }
  
--- 1007,1018 ----
  _cairo_gstate_rel_move_to (cairo_gstate_t *gstate, double dx, double dy)
  {
+     cairo_distance_t distance;
+ 
      cairo_matrix_transform_distance (&gstate->ctm, &dx, &dy);
  
!     distance.dx = _cairo_fixed_from_double (dx);
!     distance.dy = _cairo_fixed_from_double (dy);
! 
!     return _cairo_path_rel_move_to (&gstate->path, &distance);
  }
  
***************
*** 997,1017 ****
  _cairo_gstate_rel_line_to (cairo_gstate_t *gstate, double dx, double dy)
  {
      cairo_matrix_transform_distance (&gstate->ctm, &dx, &dy);
  
!     return _cairo_path_rel_line_to (&gstate->path, dx, dy);
  }
  
  cairo_status_t
  _cairo_gstate_rel_curve_to (cairo_gstate_t *gstate,
  			    double dx1, double dy1,
! 			    double dx2, double dy2,
! 			    double dx3, double dy3)
  {
      cairo_matrix_transform_distance (&gstate->ctm, &dx1, &dy1);
      cairo_matrix_transform_distance (&gstate->ctm, &dx2, &dy2);
!     cairo_matrix_transform_distance (&gstate->ctm, &dx3, &dy3);
  
      return _cairo_path_rel_curve_to (&gstate->path,
! 				     dx1, dy1, dx2, dy2, dx3, dy3);
  }
  
--- 1020,1058 ----
  _cairo_gstate_rel_line_to (cairo_gstate_t *gstate, double dx, double dy)
  {
+     cairo_distance_t distance;
+ 
      cairo_matrix_transform_distance (&gstate->ctm, &dx, &dy);
  
!     distance.dx = _cairo_fixed_from_double (dx);
!     distance.dy = _cairo_fixed_from_double (dy);
! 
!     return _cairo_path_rel_line_to (&gstate->path, &distance);
  }
  
  cairo_status_t
  _cairo_gstate_rel_curve_to (cairo_gstate_t *gstate,
+ 			    double dx0, double dy0,
  			    double dx1, double dy1,
! 			    double dx2, double dy2)
  {
+     cairo_distance_t distance[3];
+ 
+     cairo_matrix_transform_distance (&gstate->ctm, &dx0, &dy0);
      cairo_matrix_transform_distance (&gstate->ctm, &dx1, &dy1);
      cairo_matrix_transform_distance (&gstate->ctm, &dx2, &dy2);
! 
!     distance[0].dx = _cairo_fixed_from_double (dx0);
!     distance[0].dy = _cairo_fixed_from_double (dy0);
! 
!     distance[1].dx = _cairo_fixed_from_double (dx1);
!     distance[1].dy = _cairo_fixed_from_double (dy1);
! 
!     distance[2].dx = _cairo_fixed_from_double (dx2);
!     distance[2].dy = _cairo_fixed_from_double (dy2);
  
      return _cairo_path_rel_curve_to (&gstate->path,
! 				     &distance[0],
! 				     &distance[1],
! 				     &distance[2]);
  }
  
***************
*** 1037,1047 ****
  {
      cairo_status_t status;
      double x, y;
  
!     status = _cairo_path_current_point (&gstate->path, &x, &y);
      if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
  	x = 0.0;
  	y = 0.0;
      } else {
  	cairo_matrix_transform_point (&gstate->ctm_inverse, &x, &y);
      }
--- 1078,1091 ----
  {
      cairo_status_t status;
+     cairo_point_t point;
      double x, y;
  
!     status = _cairo_path_current_point (&gstate->path, &point);
      if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
  	x = 0.0;
  	y = 0.0;
      } else {
+ 	x = _cairo_fixed_to_double (point.x);
+ 	y = _cairo_fixed_to_double (point.y);
  	cairo_matrix_transform_point (&gstate->ctm_inverse, &x, &y);
      }
***************
*** 1636,1648 ****
  {
      cairo_status_t status;
      double x, y;
      cairo_matrix_t user_to_source;
      cairo_matrix_t saved_font_matrix;
  
!     status = _cairo_path_current_point (&gstate->path, &x, &y);
      if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
  	x = 0;
  	y = 0;
  	cairo_matrix_transform_point (&gstate->ctm, &x, &y);
      }
  
--- 1680,1696 ----
  {
      cairo_status_t status;
+     cairo_point_t point;
      double x, y;
      cairo_matrix_t user_to_source;
      cairo_matrix_t saved_font_matrix;
  
!     status = _cairo_path_current_point (&gstate->path, &point);
      if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
  	x = 0;
  	y = 0;
  	cairo_matrix_transform_point (&gstate->ctm, &x, &y);
+     } else {
+ 	x = _cairo_fixed_to_double (point.x);
+ 	y = _cairo_fixed_to_double (point.y);
      }
  
***************
*** 1716,1719 ****
--- 1764,1768 ----
      cairo_matrix_t user_to_source;
      cairo_matrix_t saved_font_matrix;
+     cairo_point_t point;
      double x, y;
  
***************
*** 1722,1730 ****
  	return status;
  
!     status = _cairo_path_current_point (&gstate->path, &x, &y);
      if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
  	x = 0;
  	y = 0;
  	cairo_matrix_transform_point (&gstate->ctm, &x, &y);
      }
  
--- 1771,1782 ----
  	return status;
  
!     status = _cairo_path_current_point (&gstate->path, &point);
      if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
  	x = 0;
  	y = 0;
  	cairo_matrix_transform_point (&gstate->ctm, &x, &y);
+     } else {
+ 	x = _cairo_fixed_to_double (point.x);
+ 	y = _cairo_fixed_to_double (point.y);
      }
  

Index: cairo_path.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_path.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** cairo_path.c	16 Dec 2003 15:10:48 -0000	1.12
--- cairo_path.c	13 Feb 2004 03:02:33 -0000	1.13
***************
*** 72,77 ****
      path->arg_tail = NULL;
  
!     path->current_point.x = 0.0;
!     path->current_point.y = 0.0;
      path->has_current_point = 0;
      path->last_move_point = path->current_point;
--- 72,77 ----
      path->arg_tail = NULL;
  
!     path->current_point.x = 0;
!     path->current_point.y = 0;
      path->has_current_point = 0;
      path->last_move_point = path->current_point;
***************
*** 134,151 ****
  
  cairo_status_t
! _cairo_path_move_to (cairo_path_t *path, double x, double y)
  {
      cairo_status_t status;
-     cairo_point_t point;
  
!     point.x = _cairo_fixed_from_double (x);
!     point.y = _cairo_fixed_from_double (y);
! 
!     status = _cairo_path_add (path, CAIRO_PATH_OP_MOVE_TO, &point, 1);
      if (status)
  	return status;
  
!     path->current_point.x = x;
!     path->current_point.y = y;
      path->has_current_point = 1;
      path->last_move_point = path->current_point;
--- 134,146 ----
  
  cairo_status_t
! _cairo_path_move_to (cairo_path_t *path, cairo_point_t *point)
  {
      cairo_status_t status;
  
!     status = _cairo_path_add (path, CAIRO_PATH_OP_MOVE_TO, point, 1);
      if (status)
  	return status;
  
!     path->current_point = *point;
      path->has_current_point = 1;
      path->last_move_point = path->current_point;
***************
*** 155,183 ****
  
  cairo_status_t
! _cairo_path_rel_move_to (cairo_path_t *path, double dx, double dy)
  {
!     double x, y;
  
!     x = path->current_point.x + dx;
!     y = path->current_point.y + dy;
  
!     return _cairo_path_move_to (path, x, y);
  }
  
  cairo_status_t
! _cairo_path_line_to (cairo_path_t *path, double x, double y)
  {
      cairo_status_t status;
-     cairo_point_t point;
  
!     point.x = _cairo_fixed_from_double (x);
!     point.y = _cairo_fixed_from_double (y);
! 
!     status = _cairo_path_add (path, CAIRO_PATH_OP_LINE_TO, &point, 1);
      if (status)
  	return status;
  
!     path->current_point.x = x;
!     path->current_point.y = y;
      path->has_current_point = 1;
  
--- 150,173 ----
  
  cairo_status_t
! _cairo_path_rel_move_to (cairo_path_t *path, cairo_distance_t *distance)
  {
!     cairo_point_t point;
  
!     point.x = path->current_point.x + distance->dx;
!     point.y = path->current_point.y + distance->dy;
  
!     return _cairo_path_move_to (path, &point);
  }
  
  cairo_status_t
! _cairo_path_line_to (cairo_path_t *path, cairo_point_t *point)
  {
      cairo_status_t status;
  
!     status = _cairo_path_add (path, CAIRO_PATH_OP_LINE_TO, point, 1);
      if (status)
  	return status;
  
!     path->current_point = *point;
      path->has_current_point = 1;
  
***************
*** 186,216 ****
  
  cairo_status_t
! _cairo_path_rel_line_to (cairo_path_t *path, double dx, double dy)
  {
!     double x, y;
  
!     x = path->current_point.x + dx;
!     y = path->current_point.y + dy;
  
!     return _cairo_path_line_to (path, x, y);
  }
  
  cairo_status_t
  _cairo_path_curve_to (cairo_path_t *path,
! 		      double x1, double y1,
! 		      double x2, double y2,
! 		      double x3, double y3)
  {
      cairo_status_t status;
      cairo_point_t point[3];
  
!     point[0].x = _cairo_fixed_from_double (x1);
!     point[0].y = _cairo_fixed_from_double (y1);
! 
!     point[1].x = _cairo_fixed_from_double (x2);
!     point[1].y = _cairo_fixed_from_double (y2);
! 
!     point[2].x = _cairo_fixed_from_double (x3);
!     point[2].y = _cairo_fixed_from_double (y3);
  
      status = _cairo_path_add (path, CAIRO_PATH_OP_CURVE_TO, point, 3);
--- 176,201 ----
  
  cairo_status_t
! _cairo_path_rel_line_to (cairo_path_t *path, cairo_distance_t *distance)
  {
!     cairo_point_t point;
  
!     point.x = path->current_point.x + distance->dx;
!     point.y = path->current_point.y + distance->dy;
  
!     return _cairo_path_line_to (path, &point);
  }
  
  cairo_status_t
  _cairo_path_curve_to (cairo_path_t *path,
! 		      cairo_point_t *p0,
! 		      cairo_point_t *p1,
! 		      cairo_point_t *p2)
  {
      cairo_status_t status;
      cairo_point_t point[3];
  
!     point[0] = *p0;
!     point[1] = *p1;
!     point[2] = *p2;
  
      status = _cairo_path_add (path, CAIRO_PATH_OP_CURVE_TO, point, 3);
***************
*** 218,223 ****
  	return status;
  
!     path->current_point.x = x3;
!     path->current_point.y = y3;
      path->has_current_point = 1;
  
--- 203,207 ----
  	return status;
  
!     path->current_point = *p2;
      path->has_current_point = 1;
  
***************
*** 227,246 ****
  cairo_status_t
  _cairo_path_rel_curve_to (cairo_path_t *path,
! 			  double dx1, double dy1,
! 			  double dx2, double dy2,
! 			  double dx3, double dy3)
  {
!     double x1, y1, x2, y2, x3, y3;
  
!     x1 = path->current_point.x + dx1;
!     y1 = path->current_point.y + dy1;
  
!     x2 = path->current_point.x + dx2;
!     y2 = path->current_point.y + dy2;
  
!     x3 = path->current_point.x + dx3;
!     y3 = path->current_point.y + dy3;
  
!     return _cairo_path_curve_to (path, x1, y1, x2, y2, x3, y3);
  }
  
--- 211,230 ----
  cairo_status_t
  _cairo_path_rel_curve_to (cairo_path_t *path,
! 			  cairo_distance_t *d0,
! 			  cairo_distance_t *d1,
! 			  cairo_distance_t *d2)
  {
!     cairo_point_t p0, p1, p2;
  
!     p0.x = path->current_point.x + d0->dx;
!     p0.y = path->current_point.y + d0->dy;
  
!     p1.x = path->current_point.x + d1->dx;
!     p1.y = path->current_point.y + d1->dy;
  
!     p2.x = path->current_point.x + d2->dx;
!     p2.y = path->current_point.y + d2->dy;
  
!     return _cairo_path_curve_to (path, &p0, &p1, &p2);
  }
  
***************
*** 262,272 ****
  
  cairo_status_t
! _cairo_path_current_point (cairo_path_t *path, double *x, double *y)
  {
      if (! path->has_current_point)
  	return CAIRO_STATUS_NO_CURRENT_POINT;
  
!     *x = path->current_point.x;
!     *y = path->current_point.y;
  
      return CAIRO_STATUS_SUCCESS;
--- 246,255 ----
  
  cairo_status_t
! _cairo_path_current_point (cairo_path_t *path, cairo_point_t *point)
  {
      if (! path->has_current_point)
  	return CAIRO_STATUS_NO_CURRENT_POINT;
  
!     *point = path->current_point;
  
      return CAIRO_STATUS_SUCCESS;
***************
*** 423,427 ****
  
  cairo_status_t
! _cairo_path_interpret (cairo_path_t *path, cairo_direction_t dir, const cairo_path_callbacks_t *cb, void *closure)
  {
      cairo_status_t status;
--- 406,416 ----
  
  cairo_status_t
! _cairo_path_interpret (cairo_path_t			*path,
! 		       cairo_direction_t		dir,
! 		       cairo_path_move_to_func_t	*move_to,
! 		       cairo_path_line_to_func_t	*line_to,
! 		       cairo_path_curve_to_func_t	*curve_to,
! 		       cairo_path_close_path_func_t	*close_path,
! 		       void				*closure)
  {
      cairo_status_t status;
***************
*** 473,487 ****
  	    switch (op) {
  	    case CAIRO_PATH_OP_MOVE_TO:
! 		status = (*cb->move_to) (closure, &point[0]);
  		break;
  	    case CAIRO_PATH_OP_LINE_TO:
! 		status = (*cb->line_to) (closure, &point[0]);
  		break;
  	    case CAIRO_PATH_OP_CURVE_TO:
! 		status = (*cb->curve_to) (closure, &point[0], &point[1], &point[2]);
  		break;
  	    case CAIRO_PATH_OP_CLOSE_PATH:
  	    default:
! 		status = (*cb->close_path) (closure);
  		break;
  	    }
--- 462,476 ----
  	    switch (op) {
  	    case CAIRO_PATH_OP_MOVE_TO:
! 		status = (*move_to) (closure, &point[0]);
  		break;
  	    case CAIRO_PATH_OP_LINE_TO:
! 		status = (*line_to) (closure, &point[0]);
  		break;
  	    case CAIRO_PATH_OP_CURVE_TO:
! 		status = (*curve_to) (closure, &point[0], &point[1], &point[2]);
  		break;
  	    case CAIRO_PATH_OP_CLOSE_PATH:
  	    default:
! 		status = (*close_path) (closure);
  		break;
  	    }
***************
*** 491,495 ****
      }
  
!     return (*cb->done_path) (closure);
  }
  
--- 480,484 ----
      }
  
!     return CAIRO_STATUS_SUCCESS;
  }
  

Index: cairo_path_bounds.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_path_bounds.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** cairo_path_bounds.c	9 Dec 2003 01:39:32 -0000	1.9
--- cairo_path_bounds.c	13 Feb 2004 03:02:33 -0000	1.10
***************
*** 61,67 ****
  _cairo_path_bounder_close_path (void *closure);
  
- static cairo_status_t
- _cairo_path_bounder_done_path (void *closure);
- 
  static void
  _cairo_path_bounder_init (cairo_path_bounder_t *bounder)
--- 61,64 ----
***************
*** 144,153 ****
  }
  
- static cairo_status_t
- _cairo_path_bounder_done_path (void *closure)
- {
-     return CAIRO_STATUS_SUCCESS;
- }
- 
  /* XXX: Perhaps this should compute a PixRegion rather than 4 doubles */
  cairo_status_t
--- 141,144 ----
***************
*** 155,165 ****
  {
      cairo_status_t status;
-     static cairo_path_callbacks_t const cb = {
- 	_cairo_path_bounder_move_to,
- 	_cairo_path_bounder_line_to,
- 	_cairo_path_bounder_curve_to,
- 	_cairo_path_bounder_close_path,
- 	_cairo_path_bounder_done_path
-     };
  
      cairo_path_bounder_t bounder;
--- 146,149 ----
***************
*** 167,171 ****
      _cairo_path_bounder_init (&bounder);
  
!     status = _cairo_path_interpret (path, CAIRO_DIRECTION_FORWARD, &cb, &bounder);
      if (status) {
  	*x1 = *y1 = *x2 = *y2 = 0.0;
--- 151,160 ----
      _cairo_path_bounder_init (&bounder);
  
!     status = _cairo_path_interpret (path, CAIRO_DIRECTION_FORWARD,
! 				    _cairo_path_bounder_move_to,
! 				    _cairo_path_bounder_line_to,
! 				    _cairo_path_bounder_curve_to,
! 				    _cairo_path_bounder_close_path,
! 				    &bounder);
      if (status) {
  	*x1 = *y1 = *x2 = *y2 = 0.0;

Index: cairo_path_fill.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_path_fill.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** cairo_path_fill.c	8 Dec 2003 21:38:26 -0000	1.8
--- cairo_path_fill.c	13 Feb 2004 03:02:33 -0000	1.9
***************
*** 58,64 ****
  _cairo_filler_close_path (void *closure);
  
- static cairo_status_t
- _cairo_filler_done_path (void *closure);
- 
  static void
  _cairo_filler_init (cairo_filler_t *filler, cairo_gstate_t *gstate, cairo_traps_t *traps)
--- 58,61 ----
***************
*** 165,200 ****
  }
  
- static cairo_status_t
- _cairo_filler_done_path (void *closure)
- {
-     cairo_status_t status;
-     cairo_filler_t *filler = closure;
-     cairo_polygon_t *polygon = &filler->polygon;
- 
-     status = _cairo_polygon_close (polygon);
-     if (status)
- 	return status;
- 
-     status = _cairo_traps_tessellate_polygon (filler->traps,
- 					      &filler->polygon,
- 					      filler->gstate->fill_rule);
-     if (status)
- 	return status;
- 
-     return CAIRO_STATUS_SUCCESS;
- }
- 
  cairo_status_t
  _cairo_path_fill_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps)
  {
!     static const cairo_path_callbacks_t filler_callbacks = {
! 	_cairo_filler_move_to,
! 	_cairo_filler_line_to,
! 	_cairo_filler_curve_to,
! 	_cairo_filler_close_path,
! 	_cairo_filler_done_path
!     };
! 
!     cairo_status_t status;
      cairo_filler_t filler;
  
--- 162,169 ----
  }
  
  cairo_status_t
  _cairo_path_fill_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps)
  {
!     cairo_status_t status = CAIRO_STATUS_SUCCESS;
      cairo_filler_t filler;
  
***************
*** 203,215 ****
      status = _cairo_path_interpret (path,
  				    CAIRO_DIRECTION_FORWARD,
! 				    &filler_callbacks, &filler);
!     if (status) {
! 	_cairo_filler_fini (&filler);
! 	return status;
!     }
  
      _cairo_filler_fini (&filler);
  
!     return CAIRO_STATUS_SUCCESS;
  }
  
--- 172,197 ----
      status = _cairo_path_interpret (path,
  				    CAIRO_DIRECTION_FORWARD,
! 				    _cairo_filler_move_to,
! 				    _cairo_filler_line_to,
! 				    _cairo_filler_curve_to,
! 				    _cairo_filler_close_path,
! 				    &filler);
!     if (status)
! 	goto BAIL;
! 
!     status = _cairo_polygon_close (&filler.polygon);
!     if (status)
! 	goto BAIL;
! 
!     status = _cairo_traps_tessellate_polygon (filler.traps,
! 					      &filler.polygon,
! 					      filler.gstate->fill_rule);
!     if (status)
! 	goto BAIL;
  
+ BAIL:
      _cairo_filler_fini (&filler);
  
!     return status;
  }
  

Index: cairo_path_stroke.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_path_stroke.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** cairo_path_stroke.c	24 Jan 2004 09:56:26 -0000	1.14
--- cairo_path_stroke.c	13 Feb 2004 03:02:33 -0000	1.15
***************
*** 73,79 ****
  _cairo_stroker_close_path (void *closure);
  
- static cairo_status_t
- _cairo_stroker_done_path (void *closure);
- 
  static void
  _translate_point (cairo_point_t *point, cairo_point_t *offset);
--- 73,76 ----
***************
*** 491,494 ****
--- 488,497 ----
      _compute_face (p2, &slope, gstate, end);
  
+     /* XXX: I should really check the return value of the
+        move_to/line_to functions here to catch out of memory
+        conditions. But since that would be ugly, I'd prefer to add a
+        status flag to the polygon object that I could check only once
+        at then end of this sequence, (like we do with cairo_t
+        already). */
      _cairo_polygon_init (&polygon);
      _cairo_polygon_move_to (&polygon, &start->cw);
***************
*** 782,852 ****
  }
  
- static cairo_status_t
- _cairo_stroker_done_path (void *closure)
- {
-     cairo_status_t status;
-     cairo_stroker_t *stroker = closure;
- 
-     if (stroker->has_first_face) {
- 	cairo_point_t t;
- 	/* The initial cap needs an outward facing vector. Reverse everything */
- 	stroker->first_face.usr_vector.x = -stroker->first_face.usr_vector.x;
- 	stroker->first_face.usr_vector.y = -stroker->first_face.usr_vector.y;
- 	stroker->first_face.dev_vector.dx = -stroker->first_face.dev_vector.dx;
- 	stroker->first_face.dev_vector.dy = -stroker->first_face.dev_vector.dy;
- 	t = stroker->first_face.cw;
- 	stroker->first_face.cw = stroker->first_face.ccw;
- 	stroker->first_face.ccw = t;
- 	status = _cairo_stroker_cap (stroker, &stroker->first_face);
- 	if (status)
- 	    return status;
-     }
-     if (stroker->has_current_face) {
- 	status = _cairo_stroker_cap (stroker, &stroker->current_face);
- 	if (status)
- 	    return status;
-     }
- 
-     stroker->has_first_face = 0;
-     stroker->has_current_face = 0;
-     stroker->has_current_point = 0;
- 
-     return CAIRO_STATUS_SUCCESS;
- }
- 
  cairo_status_t
  _cairo_path_stroke_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps)
  {
!     static const cairo_path_callbacks_t stroker_solid_cb = {
! 	_cairo_stroker_move_to,
! 	_cairo_stroker_line_to,
! 	_cairo_stroker_curve_to,
! 	_cairo_stroker_close_path,
! 	_cairo_stroker_done_path
!     };
!     static const cairo_path_callbacks_t stroker_dashed_cb = {
! 	_cairo_stroker_move_to,
! 	_cairo_stroker_line_to_dashed,
! 	_cairo_stroker_curve_to,
! 	_cairo_stroker_close_path,
! 	_cairo_stroker_done_path
!     };
!     const cairo_path_callbacks_t *callbacks = gstate->dash ? &stroker_dashed_cb : &stroker_solid_cb;
! 
!     cairo_status_t status;
      cairo_stroker_t stroker;
  
      _cairo_stroker_init (&stroker, gstate, traps);
  
!     status = _cairo_path_interpret (path,
! 				    CAIRO_DIRECTION_FORWARD,
! 				    callbacks, &stroker);
!     if (status) {
! 	_cairo_stroker_fini (&stroker);
! 	return status;
      }
  
      _cairo_stroker_fini (&stroker);
  
!     return CAIRO_STATUS_SUCCESS;
  }
--- 785,839 ----
  }
  
  cairo_status_t
  _cairo_path_stroke_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps)
  {
!     cairo_status_t status = CAIRO_STATUS_SUCCESS;
      cairo_stroker_t stroker;
  
      _cairo_stroker_init (&stroker, gstate, traps);
  
!     if (gstate->dash)
! 	status = _cairo_path_interpret (path,
! 					CAIRO_DIRECTION_FORWARD,
! 					_cairo_stroker_move_to,
! 					_cairo_stroker_line_to_dashed,
! 					_cairo_stroker_curve_to,
! 					_cairo_stroker_close_path,
! 					&stroker);
!     else
! 	status = _cairo_path_interpret (path,
! 					CAIRO_DIRECTION_FORWARD,
! 					_cairo_stroker_move_to,
! 					_cairo_stroker_line_to,
! 					_cairo_stroker_curve_to,
! 					_cairo_stroker_close_path,
! 					&stroker);
!     if (status)
! 	goto BAIL;
! 
!     if (stroker.has_first_face) {
! 	cairo_point_t t;
! 	/* The initial cap needs an outward facing vector. Reverse everything */
! 	stroker.first_face.usr_vector.x = -stroker.first_face.usr_vector.x;
! 	stroker.first_face.usr_vector.y = -stroker.first_face.usr_vector.y;
! 	stroker.first_face.dev_vector.dx = -stroker.first_face.dev_vector.dx;
! 	stroker.first_face.dev_vector.dy = -stroker.first_face.dev_vector.dy;
! 	t = stroker.first_face.cw;
! 	stroker.first_face.cw = stroker.first_face.ccw;
! 	stroker.first_face.ccw = t;
! 	status = _cairo_stroker_cap (&stroker, &stroker.first_face);
! 	if (status)
! 	    goto BAIL;
      }
  
+     if (stroker.has_current_face) {
+ 	status = _cairo_stroker_cap (&stroker, &stroker.current_face);
+ 	if (status)
+ 	    goto BAIL;
+     }
+ 
+ BAIL:
      _cairo_stroker_fini (&stroker);
  
!     return status;
  }

Index: cairo_traps.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_traps.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** cairo_traps.c	23 Jan 2004 04:47:24 -0000	1.13
--- cairo_traps.c	13 Feb 2004 03:02:33 -0000	1.14
***************
*** 491,495 ****
  cairo_status_t
  _cairo_traps_tessellate_polygon (cairo_traps_t		*traps,
! 				 cairo_polygon_t		*poly,
  				 cairo_fill_rule_t	fill_rule)
  {
--- 491,495 ----
  cairo_status_t
  _cairo_traps_tessellate_polygon (cairo_traps_t		*traps,
! 				 cairo_polygon_t	*poly,
  				 cairo_fill_rule_t	fill_rule)
  {

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** cairoint.h	30 Jan 2004 22:44:18 -0000	1.50
--- cairoint.h	13 Feb 2004 03:02:33 -0000	1.51
***************
*** 129,133 ****
      cairo_fixed_t dx;
      cairo_fixed_t dy;
! } cairo_slope_t;
  
  typedef struct cairo_point_double {
--- 129,133 ----
      cairo_fixed_t dx;
      cairo_fixed_t dy;
! } cairo_slope_t, cairo_distance_t;
  
  typedef struct cairo_point_double {
***************
*** 171,182 ****
  } cairo_direction_t;
  
- typedef struct cairo_path_callbacks {
-     cairo_status_t (*move_to) (void *closure, cairo_point_t *point);
-     cairo_status_t (*line_to) (void *closure, cairo_point_t *point);
-     cairo_status_t (*curve_to) (void *closure, cairo_point_t *b, cairo_point_t *c, cairo_point_t *d);
-     cairo_status_t (*close_path) (void *closure);
-     cairo_status_t (*done_path) (void *closure);
- } cairo_path_callbacks_t;
- 
  #define CAIRO_PATH_BUF_SZ 64
  
--- 171,174 ----
***************
*** 202,207 ****
      cairo_path_arg_buf_t *arg_tail;
  
!     cairo_point_double_t last_move_point;
!     cairo_point_double_t current_point;
      int has_current_point;
  } cairo_path_t;
--- 194,199 ----
      cairo_path_arg_buf_t *arg_tail;
  
!     cairo_point_t last_move_point;
!     cairo_point_t current_point;
      int has_current_point;
  } cairo_path_t;
***************
*** 537,540 ****
--- 529,535 ----
  _cairo_fixed_from_double (double d);
  
+ cairo_fixed_t
+ _cairo_fixed_from_26_6 (uint32_t i);
+ 
  extern double
  _cairo_fixed_to_double (cairo_fixed_t f);
***************
*** 913,938 ****
  
  extern cairo_status_t __internal_linkage
! _cairo_path_move_to (cairo_path_t *path, double x, double y);
  
  extern cairo_status_t __internal_linkage
! _cairo_path_rel_move_to (cairo_path_t *path, double dx, double dy);
  
  extern cairo_status_t __internal_linkage
! _cairo_path_line_to (cairo_path_t *path, double x, double y);
  
  extern cairo_status_t __internal_linkage
! _cairo_path_rel_line_to (cairo_path_t *path, double dx, double dy);
  
  extern cairo_status_t __internal_linkage
  _cairo_path_curve_to (cairo_path_t *path,
! 		      double x1, double y1,
! 		      double x2, double y2,
! 		      double x3, double y3);
  
  extern cairo_status_t __internal_linkage
  _cairo_path_rel_curve_to (cairo_path_t *path,
! 			  double dx1, double dy1,
! 			  double dx2, double dy2,
! 			  double dx3, double dy3);
  
  extern cairo_status_t __internal_linkage
--- 908,933 ----
  
  extern cairo_status_t __internal_linkage
! _cairo_path_move_to (cairo_path_t *path, cairo_point_t *point);
  
  extern cairo_status_t __internal_linkage
! _cairo_path_rel_move_to (cairo_path_t *path, cairo_slope_t *slope);
  
  extern cairo_status_t __internal_linkage
! _cairo_path_line_to (cairo_path_t *path, cairo_point_t *point);
  
  extern cairo_status_t __internal_linkage
! _cairo_path_rel_line_to (cairo_path_t *path, cairo_slope_t *slope);
  
  extern cairo_status_t __internal_linkage
  _cairo_path_curve_to (cairo_path_t *path,
! 		      cairo_point_t *p0,
! 		      cairo_point_t *p1,
! 		      cairo_point_t *p2);
  
  extern cairo_status_t __internal_linkage
  _cairo_path_rel_curve_to (cairo_path_t *path,
! 			  cairo_slope_t *s0,
! 			  cairo_slope_t *s1,
! 			  cairo_slope_t *s2);
  
  extern cairo_status_t __internal_linkage
***************
*** 940,950 ****
  
  extern cairo_status_t __internal_linkage
! _cairo_path_current_point (cairo_path_t *path, double *x, double *y);
  
  extern cairo_status_t __internal_linkage
! _cairo_path_interpret (cairo_path_t *path,
! 		       cairo_direction_t dir,
! 		       const cairo_path_callbacks_t *cb,
! 		       void *closure);
  
  extern cairo_status_t __internal_linkage
--- 935,961 ----
  
  extern cairo_status_t __internal_linkage
! _cairo_path_current_point (cairo_path_t *path, cairo_point_t *point);
! 
! typedef cairo_status_t (cairo_path_move_to_func_t) (void *closure,
! 						    cairo_point_t *point);
! 
! typedef cairo_status_t (cairo_path_line_to_func_t) (void *closure,
! 						    cairo_point_t *point);
! 
! typedef cairo_status_t (cairo_path_curve_to_func_t) (void *closure,
! 						     cairo_point_t *p0,
! 						     cairo_point_t *p1,
! 						     cairo_point_t *p2);
! 
! typedef cairo_status_t (cairo_path_close_path_func_t) (void *closure);
  
  extern cairo_status_t __internal_linkage
! _cairo_path_interpret (cairo_path_t			*path,
! 		       cairo_direction_t		dir,
! 		       cairo_path_move_to_func_t	*move_to,
! 		       cairo_path_line_to_func_t	*line_to,
! 		       cairo_path_curve_to_func_t	*curve_to,
! 		       cairo_path_close_path_func_t	*close_path,
! 		       void				*closure);
  
  extern cairo_status_t __internal_linkage





More information about the cairo-commit mailing list