[cairo-commit] cairo/src cairo_gstate.c,1.54,1.55

Carl Worth commit at pdx.freedesktop.org
Fri Jul 9 13:47:48 PDT 2004


Committed by: cworth

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

Modified Files:
	cairo_gstate.c 
Log Message:
        * src/cairo_gstate.c (_cairo_gstate_arc_dir): Fix numerical
        problem that could lead to infinite loops.


Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** cairo_gstate.c	21 Jun 2004 22:13:52 -0000	1.54
--- cairo_gstate.c	9 Jul 2004 20:47:46 -0000	1.55
***************
*** 880,902 ****
      /* Recurse if drawing arc larger than pi */
      if (angle_max - angle_min > M_PI) {
  	/* XXX: Something tells me this block could be condensed. */
  	if (dir == CAIRO_DIRECTION_FORWARD) {
  	    status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
! 					    angle_min, angle_min + M_PI, dir);
  	    if (status)
  		return status;
  	    
  	    status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
! 					    angle_min + M_PI, angle_max, dir);
  	    if (status)
  		return status;
  	} else {
  	    status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
! 					    angle_min + M_PI, angle_max, dir);
  	    if (status)
  		return status;
  
  	    status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
! 					    angle_min, angle_min + M_PI, dir);
  	    if (status)
  		return status;
--- 880,903 ----
      /* Recurse if drawing arc larger than pi */
      if (angle_max - angle_min > M_PI) {
+ 	double angle_mid = angle_min + (angle_max - angle_min) / 2.0;
  	/* XXX: Something tells me this block could be condensed. */
  	if (dir == CAIRO_DIRECTION_FORWARD) {
  	    status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
! 					    angle_min, angle_mid, dir);
  	    if (status)
  		return status;
  	    
  	    status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
! 					    angle_mid, angle_max, dir);
  	    if (status)
  		return status;
  	} else {
  	    status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
! 					    angle_mid, angle_max, dir);
  	    if (status)
  		return status;
  
  	    status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
! 					    angle_min, angle_mid, dir);
  	    if (status)
  		return status;





More information about the cairo-commit mailing list