[gs-cvs] rev 8085 - trunk/gs/src

leonardo at ghostscript.com leonardo at ghostscript.com
Fri Jun 29 02:28:33 PDT 2007


Author: leonardo
Date: 2007-06-29 02:28:27 -0700 (Fri, 29 Jun 2007)
New Revision: 8085

Modified:
   trunk/gs/src/gxcldev.h
   trunk/gs/src/gxclimag.c
   trunk/gs/src/gxclpath.c
   trunk/gs/src/gxclrect.c
Log:
Fix : Expanding gxcldev.h macros, part 3.

DETAILS :

This change is algorithmically equivalent.
The purpose is to eliminate gxcldev.h macros
to simplify the debugging of the clist writer methods.

This 3nd step collects local variables
of a rectangle enumerator in a single structure
cmd_rects_enum_s.

In the old code the macro FOR_RECTS modifies
function arguments 'y' and 'height'.
It doesn't comply with C-style.htm .
For fixing that this patch renames
function arguments x,y,width,height with
rx,ry,rwidth,rheight.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gxcldev.h
===================================================================
--- trunk/gs/src/gxcldev.h	2007-06-28 22:16:45 UTC (rev 8084)
+++ trunk/gs/src/gxcldev.h	2007-06-29 09:28:27 UTC (rev 8085)
@@ -557,28 +557,33 @@
  * permanent_error, which prevents writing to the command list.
  */
 
-/*
- * The "if (1)" statements in the following macros are there to prevent
- * stupid compilers from giving "statement not reached" warnings.
- */
+typedef struct cmd_rects_enum_s {
+	int y;
+	int height;
+	int yend;
+	int band_height;
+	int band_code;
+	int band;
+	gx_clist_state *pcls;
+	int band_end;
+} cmd_rects_enum_t;
 
-#define FOR_RECTS\
+#define FOR_RECTS(re, yvar, heightvar)\
     BEGIN\
-	int yend = y + height;\
-	int band_height = cdev->page_band_height;\
-	int band_code;\
-\
+	re.y = yvar;\
+	re.height = heightvar;\
+	re.yend = re.y + re.height;\
+	re.band_height = cdev->page_band_height;\
 	do {\
-	    int band = y / band_height;\
-	    gx_clist_state *pcls = cdev->states + band;\
-	    int band_end = (band + 1) * band_height;\
-\
-	    height = min(band_end, yend) - y;\
+	    re.band = re.y / re.band_height;\
+	    re.pcls = cdev->states + re.band;\
+	    re.band_end = (re.band + 1) * re.band_height;\
+	    re.height = min(re.band_end, re.yend) - re.y;\
 retry_rect:\
 	    ;
 
 #define RECT_RECOVER(codevar) (codevar < 0 && (codevar = clist_VMerror_recover(cdev, codevar)) >= 0)
-#define SET_BAND_CODE(codevar) (band_code = codevar)
+#define SET_BAND_CODE(codevar) (re.band_code = codevar)
 
 #define END_RECTS_ON_ERROR(retry_cleanup, is_error, after_recovering)\
 	    continue;\
@@ -587,13 +592,13 @@
 		    retry_cleanup;\
 		    if ((is_error) &&\
 			cdev->driver_call_nesting == 0 &&\
-			SET_BAND_CODE(clist_VMerror_recover_flush(cdev, band_code)) >= 0 &&\
+			SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0 &&\
 			(after_recovering)\
 			)\
 			goto retry_rect;\
 		}\
-		return band_code;\
-	} while ((y += height) < yend);\
+		return re.band_code;\
+	} while ((re.y += re.height) < re.yend);\
     END
 #define END_RECTS END_RECTS_ON_ERROR(DO_NOTHING, 1, 1)
 

Modified: trunk/gs/src/gxclimag.c
===================================================================
--- trunk/gs/src/gxclimag.c	2007-06-28 22:16:45 UTC (rev 8084)
+++ trunk/gs/src/gxclimag.c	2007-06-29 09:28:27 UTC (rev 8085)
@@ -54,7 +54,7 @@
 int
 clist_fill_mask(gx_device * dev,
 		const byte * data, int data_x, int raster, gx_bitmap_id id,
-		int x, int y, int width, int height,
+		int rx, int ry, int rwidth, int rheight,
 		const gx_drawing_color * pdcolor, int depth,
 		gs_logical_operation_t lop, const gx_clip_path * pcpath)
 {
@@ -62,9 +62,9 @@
 	&((gx_device_clist *)dev)->writer;
     const byte *orig_data = data;	/* for writing tile */
     int orig_data_x = data_x;	/* ditto */
-    int orig_x = x;		/* ditto */
-    int orig_width = width;	/* ditto */
-    int orig_height = height;	/* ditto */
+    int orig_x = rx;		/* ditto */
+    int orig_width = rwidth;	/* ditto */
+    int orig_height = rheight;	/* ditto */
     int log2_depth = ilog2(depth);
     int y0;
     int data_x_bit;
@@ -74,14 +74,15 @@
     bool slow_rop =
 	cmd_slow_rop(dev, lop_know_S_0(lop), pdcolor) ||
 	cmd_slow_rop(dev, lop_know_S_1(lop), pdcolor);
+    cmd_rects_enum_t re;
 
     /* If depth > 1, this call will be translated to a copy_alpha call. */
     /* if the target device can't perform copy_alpha, exit now. */
     if (depth > 1 && (cdev->disable_mask & clist_disable_copy_alpha) != 0)
 	return_error(gs_error_unknownerror);
 
-    fit_copy(dev, data, data_x, raster, id, x, y, width, height);
-    y0 = y;			/* must do after fit_copy */
+    fit_copy(dev, data, data_x, raster, id, rx, ry, rwidth, rheight);
+    y0 = ry;			/* must do after fit_copy */
 
     /* If non-trivial clipping & complex clipping disabled, default */
     /* Also default for uncached bitmap or non-defaul lop; */
@@ -90,13 +91,13 @@
     /* Lastly, the command list will translate calls with depth > 1 to */
     /* copy_alpha calls, so the device color must be pure */
     if (((cdev->disable_mask & clist_disable_complex_clip) &&
-	 !check_rect_for_trivial_clip(pcpath, x, y, x + width, y + height)) ||
+	 !check_rect_for_trivial_clip(pcpath, rx, ry, rx + rwidth, ry + rheight)) ||
 	gs_debug_c('`') || id == gx_no_bitmap_id || lop != lop_default ||
 	(depth > 1 && !color_writes_pure(pdcolor, lop))
 	)
   copy:
 	return gx_default_fill_mask(dev, data, data_x, raster, id,
-				    x, y, width, height, pdcolor, depth,
+				    rx, ry, rwidth, rheight, pdcolor, depth,
 				    lop, pcpath);
 
     if (cmd_check_clip_path(cdev, pcpath))
@@ -104,49 +105,49 @@
     data_x_bit = data_x << log2_depth;
     if (cdev->permanent_error < 0)
       return (cdev->permanent_error);
-    FOR_RECTS {
-	int code;
+    FOR_RECTS(re, ry, rheight) {
+		int code;
         ulong offset_temp;
 
 	do {
-	    code = cmd_update_lop(cdev, pcls, lop);
+	    code = cmd_update_lop(cdev, re.pcls, lop);
 	} while (RECT_RECOVER(code));
 	/* HANDLE_RECT_UNLESS(code, 0); */
 	if (code < 0 && SET_BAND_CODE(code))
 	    goto error_in_rect;
-	if (depth > 1 && !pcls->color_is_alpha) {
+	if (depth > 1 && !re.pcls->color_is_alpha) {
 	    byte *dp;
 
 	    do {
 		code =
-		    set_cmd_put_op(dp, cdev, pcls, cmd_opv_set_copy_alpha, 1);
+		    set_cmd_put_op(dp, cdev, re.pcls, cmd_opv_set_copy_alpha, 1);
 	    } while (RECT_RECOVER(code));
 	    /* HANDLE_RECT_UNLESS(code, 0); */
 	    if (code < 0 && SET_BAND_CODE(code))
-		goto error_in_rect;
-	    pcls->color_is_alpha = 1;
+			goto error_in_rect;
+	    re.pcls->color_is_alpha = 1;
 	}
 	do {
-	    code = cmd_do_write_unknown(cdev, pcls, clip_path_known);
+	    code = cmd_do_write_unknown(cdev, re.pcls, clip_path_known);
 	    if (code >= 0)
-		code = cmd_do_enable_clip(cdev, pcls, pcpath != NULL);
+			code = cmd_do_enable_clip(cdev, re.pcls, pcpath != NULL);
 	} while (RECT_RECOVER(code));
 	/* HANDLE_RECT_UNLESS(code, 0); */
 	if (code < 0 && SET_BAND_CODE(code))
 	    goto error_in_rect;
 	do {
-	    code = cmd_put_drawing_color(cdev, pcls, pdcolor);
+	    code = cmd_put_drawing_color(cdev, re.pcls, pdcolor);
 	    if (depth > 1 && code >= 0)
-		code = cmd_set_color1(cdev, pcls, pdcolor->colors.pure);
+			code = cmd_set_color1(cdev, re.pcls, pdcolor->colors.pure);
 	} while (RECT_RECOVER(code));
 	/* HANDLE_RECT_UNLESS(code, 0); */
 	if (code < 0 && SET_BAND_CODE(code))
 	    goto error_in_rect;
-	pcls->colors_used.slow_rop |= slow_rop;
-	pcls->band_complexity.nontrivial_rops |= slow_rop;
-	pcls->band_complexity.uses_color |= (pdcolor->colors.pure != 0 && pdcolor->colors.pure != 0xffffff);
+	re.pcls->colors_used.slow_rop |= slow_rop;
+	re.pcls->band_complexity.nontrivial_rops |= slow_rop;
+	re.pcls->band_complexity.uses_color |= (pdcolor->colors.pure != 0 && pdcolor->colors.pure != 0xffffff);
 	/* Put it in the cache if possible. */
-	if (!cls_has_tile_id(cdev, pcls, id, offset_temp)) {
+	if (!cls_has_tile_id(cdev, re.pcls, id, offset_temp)) {
 	    gx_strip_bitmap tile;
 
 	    tile.data = (byte *) orig_data;	/* actually const */
@@ -156,7 +157,7 @@
 	    tile.rep_shift = tile.shift = 0;
 	    tile.id = id;
 	    do {
-	        code = clist_change_bits(cdev, pcls, &tile, depth);
+	        code = clist_change_bits(cdev, re.pcls, &tile, depth);
 	    } while (RECT_RECOVER(code));
 	    /* HANDLE_RECT_UNLESS(code, (code != gs_error_VMerror || !cdev->error_is_retryable) ); */
 	    if (code < 0 && !(code != gs_error_VMerror || !cdev->error_is_retryable) && SET_BAND_CODE(code))
@@ -174,15 +175,15 @@
 	    /* Output a command to copy the entire character. */
 	    /* It will be truncated properly per band. */
 	    rect.x = orig_x, rect.y = y0;
-	    rect.width = orig_width, rect.height = yend - y0;
+	    rect.width = orig_width, rect.height = re.yend - y0;
 	    rsize = 1 + cmd_sizexy(rect);
 	    do {
 	        code = (orig_data_x ?
-	      		cmd_put_set_data_x(cdev, pcls, orig_data_x) : 0);
+	      		cmd_put_set_data_x(cdev, re.pcls, orig_data_x) : 0);
 		if (code >= 0) {
 		    byte *dp;
 
-		    code = set_cmd_put_op(dp, cdev, pcls, op, rsize);
+		    code = set_cmd_put_op(dp, cdev, re.pcls, op, rsize);
 		    /*
 		     * The following conditional is unnecessary: the two
 		     * statements inside it should go outside the
@@ -200,7 +201,7 @@
 	    /* HANDLE_RECT_UNLESS(code, 0); */
 	    if (code < 0 && SET_BAND_CODE(code))
 		goto error_in_rect;
-	    pcls->rect = rect;
+	    re.pcls->rect = rect;
 	    goto end;
 	}
 end:
@@ -573,8 +574,9 @@
     int y_orig = pie->y;
     int yh_used = min(yh, pie->rect.q.y - y_orig);
     int y0, y1;
-    int y, height;		/* for BEGIN/END_RECT */
+    int ry, rheight;
     int code;
+    cmd_rects_enum_t re;
 
 #ifdef DEBUG
     if (pie->id != cdev->image_enum_id) {
@@ -611,7 +613,7 @@
     {
 	int ry0 = (int)floor(dbox.p.y) - 2;
 	int ry1 = (int)ceil(dbox.q.y) + 2;
-	int band_height = cdev->page_band_height;
+	int band_height0 = cdev->page_band_height;
 
 	/*
 	 * Make sure we don't go into any bands beyond the Y range
@@ -628,13 +630,13 @@
 	if (ry0 >= ry1)
 	    goto done;
 	/* Expand the range out to band boundaries. */
-	y = ry0 / band_height * band_height;
-	height = min(ROUND_UP(ry1, band_height), dev->height) - y;
+	ry = ry0 / band_height0 * band_height0;
+	rheight = min(ROUND_UP(ry1, band_height0), dev->height) - ry;
     }
 
     if (cdev->permanent_error < 0)
       return (cdev->permanent_error);
-    FOR_RECTS {
+    FOR_RECTS(re, ry, rheight) {
 	/*
 	 * Just transmit the subset of the data that intersects this band.
 	 * Note that y and height always define a complete band.
@@ -642,7 +644,7 @@
 	gs_int_rect ibox;
 	gs_int_rect entire_box;
 
-	if (!image_band_box(dev, pie, y, height, &ibox))
+	if (!image_band_box(dev, pie, re.y, re.height, &ibox))
 	    continue;
 	/*
 	 * The transmitted subrectangle has to be computed at the time
@@ -650,21 +652,21 @@
 	 * much of each scan line we write out.
 	 */
 	{
-	    int band_ymax = min(band_end, pie->ymax);
-	    int band_ymin = max(band_end - band_height, pie->ymin);
+	    int band_ymax = min(re.band_end, pie->ymax);
+	    int band_ymin = max(re.band_end - re.band_height, pie->ymin);
 
 	    if (!image_band_box(dev, pie, band_ymin,
 				band_ymax - band_ymin, &entire_box))
 		continue;
 	}
 
-	pcls->colors_used.or |= pie->colors_used.or;
-	pcls->band_complexity.nontrivial_rops |= 
-	    pcls->colors_used.slow_rop |= pie->colors_used.slow_rop;
-	pcls->band_complexity.uses_color |= (pie->colors_used.or != 0 || pie->colors_used.or != 0xffffff);
+	re.pcls->colors_used.or |= pie->colors_used.or;
+	re.pcls->band_complexity.nontrivial_rops |= 
+	    re.pcls->colors_used.slow_rop |= pie->colors_used.slow_rop;
+	re.pcls->band_complexity.uses_color |= (pie->colors_used.or != 0 || pie->colors_used.or != 0xffffff);
 
 	/* Write out begin_image & its preamble for this band */
-	if (!(pcls->known & begin_image_known)) {
+	if (!(re.pcls->known & begin_image_known)) {
 	    gs_logical_operation_t lop = pie->pis->log_op;
 	    byte *dp;
 	    byte *bp = pie->begin_image_command +
@@ -684,19 +686,19 @@
 				(pie->color_space.id == gs_no_id ? 0 :
 							 color_space_known);
 
-		    code = cmd_do_write_unknown(cdev, pcls, want_known);
+		    code = cmd_do_write_unknown(cdev, re.pcls, want_known);
 		}
 		if (code >= 0)
-		    code = cmd_do_enable_clip(cdev, pcls, pie->pcpath != NULL);
+		    code = cmd_do_enable_clip(cdev, re.pcls, pie->pcpath != NULL);
 		if (code >= 0)
-		    code = cmd_update_lop(cdev, pcls, lop);
+		    code = cmd_update_lop(cdev, re.pcls, lop);
 	    } while (RECT_RECOVER(code));
 	    /* HANDLE_RECT_UNLESS(code, 0); */
 	    if (code < 0 && SET_BAND_CODE(code))
 		goto error_in_rect;
 	    if (pie->uses_color) {
  	        do {
-		    code = cmd_put_drawing_color(cdev, pcls, &pie->dcolor);
+		    code = cmd_put_drawing_color(cdev, re.pcls, &pie->dcolor);
 		} while (RECT_RECOVER(code));
 		/* HANDLE_RECT_UNLESS(code, 0); */
 		if (code < 0 && SET_BAND_CODE(code))
@@ -714,7 +716,7 @@
 	    len = bp - pie->begin_image_command;
 	    do {
 		code =
-		    set_cmd_put_op(dp, cdev, pcls, image_op, 1 + len);
+		    set_cmd_put_op(dp, cdev, re.pcls, image_op, 1 + len);
 	    } while (RECT_RECOVER(code));
 	    /* HANDLE_RECT_UNLESS(code, 0); */
 	    if (code < 0 && SET_BAND_CODE(code))
@@ -722,7 +724,7 @@
 	    memcpy(dp + 1, pie->begin_image_command, len);
  
 	    /* Mark band's begin_image as known */
-	    pcls->known |= begin_image_known;
+	    re.pcls->known |= begin_image_known;
 	}
 
 	/*
@@ -770,7 +772,7 @@
 	    for (iy = by0, ih = by1 - by0; ih > 0; iy += nrows, ih -= nrows) {
 		nrows = min(ih, rows_per_cmd);
 		do {
-		    code = cmd_image_plane_data(cdev, pcls, planes, info,
+		    code = cmd_image_plane_data(cdev, re.pcls, planes, info,
 						bytes_per_plane, offsets,
 						xoff - xskip, nrows);
 		} while (RECT_RECOVER(code));
@@ -1451,31 +1453,32 @@
     gx_device_clist_writer * const cdev =
 	&((gx_device_clist *)dev)->writer;
     int code;
-    int y = pie->ymin;
-    int height = pie->ymax - y;
+    int ry = pie->ymin;
+    int rheight = pie->ymax - ry;
+    cmd_rects_enum_t re;
 
     /*
      * We need to check specially for images lying entirely outside the
      * page, since FOR_RECTS doesn't do this.
      */
-    if (height <= 0)
+    if (rheight <= 0)
 	return 0;
     if (cdev->permanent_error < 0)
       return (cdev->permanent_error);
-    FOR_RECTS {
+    FOR_RECTS(re, ry, rheight) {
 	byte *dp;
 
-	if (!(pcls->known & begin_image_known))
+	if (!(re.pcls->known & begin_image_known))
 	    continue;
 	do {
-	    if_debug1('L', "[L]image_end for band %d\n", band);
-	    code = set_cmd_put_op(dp, cdev, pcls, cmd_opv_image_data, 2);
+	    if_debug1('L', "[L]image_end for band %d\n", re.band);
+	    code = set_cmd_put_op(dp, cdev, re.pcls, cmd_opv_image_data, 2);
 	} while (RECT_RECOVER(code));
 	/* HANDLE_RECT_UNLESS(code, 0); */
 	if (code < 0 && SET_BAND_CODE(code))
 	    goto error_in_rect;
 	dp[1] = 0;	    /* EOD */
-	pcls->known ^= begin_image_known;
+	re.pcls->known ^= begin_image_known;
     } END_RECTS;
     return 0;
 }

Modified: trunk/gs/src/gxclpath.c
===================================================================
--- trunk/gs/src/gxclpath.c	2007-06-28 22:16:45 UTC (rev 8084)
+++ trunk/gs/src/gxclpath.c	2007-06-29 09:28:27 UTC (rev 8085)
@@ -569,13 +569,14 @@
     gx_device_clist_writer * const cdev =
 	&((gx_device_clist *)dev)->writer;
     uint unknown = 0;
-    int y, height, y0, y1;
+    int ry, rheight, y0, y1;
     gs_logical_operation_t lop = pis->log_op;
     byte op = (byte)
 	(params->rule == gx_rule_even_odd ?
 	 cmd_opv_eofill : cmd_opv_fill);
     gs_fixed_point adjust;
     bool slow_rop = cmd_slow_rop(dev, lop_know_S_0(lop), pdcolor);
+    cmd_rects_enum_t re;
 
     if ( (cdev->disable_mask & clist_disable_fill_path) ||
 	 gs_debug_c(',')
@@ -589,40 +590,40 @@
 	gs_fixed_rect bbox;
 
 	gx_path_bbox(ppath, &bbox);
-	y = fixed2int(bbox.p.y) - 1;
-	height = fixed2int_ceiling(bbox.q.y) - y + 1;
-	fit_fill_y(dev, y, height);
-	fit_fill_h(dev, y, height);
-	if (height <= 0)
+	ry = fixed2int(bbox.p.y) - 1;
+	rheight = fixed2int_ceiling(bbox.q.y) - ry + 1;
+	fit_fill_y(dev, ry, rheight);
+	fit_fill_h(dev, ry, rheight);
+	if (rheight <= 0)
 	    return 0;
     }
-    y0 = y;
-    y1 = y + height;
+    y0 = ry;
+    y1 = ry + rheight;
     cmd_check_fill_known(cdev, pis, params->flatness, &adjust, pcpath,
 			 &unknown);
     if (unknown)
 	cmd_clear_known(cdev, unknown);
     if (cdev->permanent_error < 0)
       return (cdev->permanent_error);
-    FOR_RECTS {
-	int code = cmd_do_write_unknown(cdev, pcls, FILL_KNOWN);
+    FOR_RECTS(re, ry, rheight) {
+	int code = cmd_do_write_unknown(cdev, re.pcls, FILL_KNOWN);
 
 	if (code < 0)
 	    return code;
-	if ((code = cmd_do_enable_clip(cdev, pcls, pcpath != NULL)) < 0 ||
-	    (code = cmd_update_lop(cdev, pcls, lop)) < 0
+	if ((code = cmd_do_enable_clip(cdev, re.pcls, pcpath != NULL)) < 0 ||
+	    (code = cmd_update_lop(cdev, re.pcls, lop)) < 0
 	    )
 	    return code;
-	code = cmd_put_drawing_color(cdev, pcls, pdcolor);
+	code = cmd_put_drawing_color(cdev, re.pcls, pdcolor);
 	if (code < 0) {
 	    /* Something went wrong, use the default implementation. */
 	    return gx_default_fill_path(dev, pis, ppath, params, pdcolor,
 					pcpath);
 	}
-	pcls->colors_used.slow_rop |= slow_rop;
-	code = cmd_put_path(cdev, pcls, ppath,
-			    int2fixed(max(y - 1, y0)),
-			    int2fixed(min(y + height + 1, y1)),
+	re.pcls->colors_used.slow_rop |= slow_rop;
+	code = cmd_put_path(cdev, re.pcls, ppath,
+			    int2fixed(max(re.y - 1, y0)),
+			    int2fixed(min(re.y + re.height + 1, y1)),
 			    op,
 			    true, sn_none /* fill doesn't need the notes */ );
 	if (code < 0)
@@ -643,9 +644,10 @@
     gs_fixed_rect bbox;
     gs_fixed_point expansion;
     int adjust_y, expansion_code;
-    int y, height;
+    int ry, rheight;
     gs_logical_operation_t lop = pis->log_op;
     bool slow_rop = cmd_slow_rop(dev, lop_know_S_0(lop), pdcolor);
+    cmd_rects_enum_t re;
 
     if ((cdev->disable_mask & clist_disable_stroke_path) ||
 	gs_debug_c(',')
@@ -661,15 +663,15 @@
     if (expansion_code < 0) {
 	/* Expansion is too large: use the entire page. */
 	adjust_y = 0;
-	y = 0;
-	height = dev->height;
+	ry = 0;
+	rheight = dev->height;
     } else {
 	adjust_y = fixed2int_ceiling(expansion.y) + 1;
-	y = fixed2int(bbox.p.y) - adjust_y;
-	height = fixed2int_ceiling(bbox.q.y) - y + adjust_y;
-	fit_fill_y(dev, y, height);
-	fit_fill_h(dev, y, height);
-	if (height <= 0)
+	ry = fixed2int(bbox.p.y) - adjust_y;
+	rheight = fixed2int_ceiling(bbox.q.y) - ry + adjust_y;
+	fit_fill_y(dev, ry, rheight);
+	fit_fill_h(dev, ry, rheight);
+	if (rheight <= 0)
 	    return 0;
     }
     /* Check the dash pattern, since we bail out if */
@@ -737,21 +739,21 @@
 	cmd_clear_known(cdev, unknown);
     if (cdev->permanent_error < 0)
       return (cdev->permanent_error);
-    FOR_RECTS {
+    FOR_RECTS(re, ry, rheight) {
 	int code;
 
-	if ((code = cmd_do_write_unknown(cdev, pcls, stroke_all_known)) < 0 ||
-	    (code = cmd_do_enable_clip(cdev, pcls, pcpath != NULL)) < 0 ||
-	    (code = cmd_update_lop(cdev, pcls, lop)) < 0
+	if ((code = cmd_do_write_unknown(cdev, re.pcls, stroke_all_known)) < 0 ||
+	    (code = cmd_do_enable_clip(cdev, re.pcls, pcpath != NULL)) < 0 ||
+	    (code = cmd_update_lop(cdev, re.pcls, lop)) < 0
 	    )
 	    return code;
-	code = cmd_put_drawing_color(cdev, pcls, pdcolor);
+	code = cmd_put_drawing_color(cdev, re.pcls, pdcolor);
 	if (code < 0) {
 	    /* Something went wrong, use the default implementation. */
 	    return gx_default_stroke_path(dev, pis, ppath, params, pdcolor,
 					  pcpath);
 	}
-	pcls->colors_used.slow_rop |= slow_rop;
+	re.pcls->colors_used.slow_rop |= slow_rop;
 	{
 	    fixed ymin, ymax;
 
@@ -766,10 +768,10 @@
 		ymin = min_fixed;
 		ymax = max_fixed;
 	    } else {
-		ymin = int2fixed(y - adjust_y);
-		ymax = int2fixed(y + height + adjust_y);
+		ymin = int2fixed(re.y - adjust_y);
+		ymax = int2fixed(re.y + re.height + adjust_y);
 	    }
-	    code = cmd_put_path(cdev, pcls, ppath, ymin, ymax,
+	    code = cmd_put_path(cdev, re.pcls, ppath, ymin, ymax,
 				cmd_opv_stroke,
 				false, (segment_notes)~0);
 	    if (code < 0)
@@ -797,8 +799,9 @@
     gx_device_clist_writer * const cdev =
 	&((gx_device_clist *)dev)->writer;
     gs_fixed_rect bbox;
-    int y, height, y0, y1;
+    int ry, rheight, y0, y1;
     bool slow_rop = cmd_slow_rop(dev, lop_know_S_0(lop), pdcolor);
+    cmd_rects_enum_t re;
 
     if (gs_debug_c(','))
 	return -1;		/* path-based banding is disabled */
@@ -808,24 +811,24 @@
 	)
 	goto out;
     gx_path_bbox(&path, &bbox);
-    y = fixed2int(bbox.p.y) - 1;
-    height = fixed2int_ceiling(bbox.q.y) - y + 1;
-    fit_fill_y(dev, y, height);
-    fit_fill_h(dev, y, height);
-    if (height <= 0)
+    ry = fixed2int(bbox.p.y) - 1;
+    rheight = fixed2int_ceiling(bbox.q.y) - ry + 1;
+    fit_fill_y(dev, ry, rheight);
+    fit_fill_h(dev, ry, rheight);
+    if (rheight <= 0)
 	return 0;
-    y0 = y;
-    y1 = y + height;
+    y0 = ry;
+    y1 = ry + rheight;
     if (cdev->permanent_error < 0)
       return (cdev->permanent_error);
-    FOR_RECTS {
-	if ((code = cmd_update_lop(cdev, pcls, lop)) < 0 ||
-	    (code = cmd_put_drawing_color(cdev, pcls, pdcolor)) < 0)
+    FOR_RECTS(re, ry, rheight) {
+	if ((code = cmd_update_lop(cdev, re.pcls, lop)) < 0 ||
+	    (code = cmd_put_drawing_color(cdev, re.pcls, pdcolor)) < 0)
 	    goto out;
-	pcls->colors_used.slow_rop |= slow_rop;
-	code = cmd_put_path(cdev, pcls, &path,
-			    int2fixed(max(y - 1, y0)),
-			    int2fixed(min(y + height + 1, y1)),
+	re.pcls->colors_used.slow_rop |= slow_rop;
+	code = cmd_put_path(cdev, re.pcls, &path,
+			    int2fixed(max(re.y - 1, y0)),
+			    int2fixed(min(re.y + re.height + 1, y1)),
 			    cmd_opv_polyfill,
 			    true, sn_none /* fill doesn't need the notes */ );
 	if (code < 0)

Modified: trunk/gs/src/gxclrect.c
===================================================================
--- trunk/gs/src/gxclrect.c	2007-06-28 22:16:45 UTC (rev 8084)
+++ trunk/gs/src/gxclrect.c	2007-06-29 09:28:27 UTC (rev 8085)
@@ -135,27 +135,28 @@
 /* ---------------- Driver procedures ---------------- */
 
 int
-clist_fill_rectangle(gx_device * dev, int x, int y, int width, int height,
+clist_fill_rectangle(gx_device * dev, int rx, int ry, int rwidth, int rheight,
 		     gx_color_index color)
 {
     gx_device_clist_writer * const cdev =
 	&((gx_device_clist *)dev)->writer;
     int code;
+    cmd_rects_enum_t re;
 
-    fit_fill(dev, x, y, width, height);
+    fit_fill(dev, rx, ry, rwidth, rheight);
     if (cdev->permanent_error < 0)
       return (cdev->permanent_error);
-    FOR_RECTS {
-	pcls->colors_used.or |= color;
-	pcls->band_complexity.uses_color |= ((color != 0xffffff) && (color != 0)); 
+    FOR_RECTS(re, ry, rheight) {
+	re.pcls->colors_used.or |= color;
+	re.pcls->band_complexity.uses_color |= ((color != 0xffffff) && (color != 0)); 
 	do {
-	    code = cmd_disable_lop(cdev, pcls);
-	    if (code >= 0 && color != pcls->colors[1])
-		code = cmd_put_color(cdev, pcls, &clist_select_color1,
-				     color, &pcls->colors[1]);
+	    code = cmd_disable_lop(cdev, re.pcls);
+	    if (code >= 0 && color != re.pcls->colors[1])
+		code = cmd_put_color(cdev, re.pcls, &clist_select_color1,
+				     color, &re.pcls->colors[1]);
 	    if (code >= 0)
-		code = cmd_write_rect_cmd(cdev, pcls, cmd_op_fill_rect, x, y,
-					  width, height);
+		code = cmd_write_rect_cmd(cdev, re.pcls, cmd_op_fill_rect, rx, re.y,
+					  rwidth, re.height);
 	} while (RECT_RECOVER(code));
 	/* HANDLE_RECT_UNLESS(code, 0); */
 	if (code < 0 && SET_BAND_CODE(code))
@@ -166,7 +167,7 @@
 
 int
 clist_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tile,
-			   int x, int y, int width, int height,
+			   int rx, int ry, int rwidth, int rheight,
 	       gx_color_index color0, gx_color_index color1, int px, int py)
 {
     gx_device_clist_writer * const cdev =
@@ -181,29 +182,30 @@
 	 (color0 == gx_no_color_index ? 0 : color0) |
 	 (color1 == gx_no_color_index ? 0 : color1));
     int code;
+    cmd_rects_enum_t re;
 
-    fit_fill(dev, x, y, width, height);
+    fit_fill(dev, rx, ry, rwidth, rheight);
     if (cdev->permanent_error < 0)
       return (cdev->permanent_error);
-    FOR_RECTS {
+    FOR_RECTS(re, ry, rheight) {
 	ulong offset_temp;
 
-	pcls->colors_used.or |= colors_used;	
-	pcls->band_complexity.uses_color |= 
+	re.pcls->colors_used.or |= colors_used;	
+	re.pcls->band_complexity.uses_color |= 
 	    ((color0 != gx_no_color_index) && (color0 != 0xffffff) && (color0 != 0)) ||
 	    ((color1 != gx_no_color_index) && (color1 != 0xffffff) && (color1 != 0));
 
 	do {
-	    code = cmd_disable_lop(cdev, pcls);
+	    code = cmd_disable_lop(cdev, re.pcls);
 	} while (RECT_RECOVER(code));
 	/* HANDLE_RECT_UNLESS(code, 0); */
 	if (code < 0 && SET_BAND_CODE(code))
 	    goto error_in_rect;
-	if (!cls_has_tile_id(cdev, pcls, tile->id, offset_temp)) {
+	if (!cls_has_tile_id(cdev, re.pcls, tile->id, offset_temp)) {
 	    code = 0;
 	    if (tile->id != gx_no_bitmap_id) {
 		do {
-		    code = clist_change_tile(cdev, pcls, tile, depth);
+		    code = clist_change_tile(cdev, re.pcls, tile, depth);
 		} while (RECT_RECOVER(code));
 		/* HANDLE_RECT_UNLESS(code, (code != gs_error_VMerror || !cdev->error_is_retryable)); */
 		if (code < 0 && !(code != gs_error_VMerror || !cdev->error_is_retryable) && SET_BAND_CODE(code))
@@ -213,7 +215,7 @@
 		/* ok if gx_default... does retries internally: */
 		/* it's self-sufficient */
 		code = gx_default_strip_tile_rectangle(dev, tile,
-						       x, y, width, height,
+						       rx, re.y, rwidth, re.height,
 						       color0, color1,
 						       px, py);
 		if (code < 0 && SET_BAND_CODE(code))
@@ -223,15 +225,15 @@
 	}
 	do {
 	    code = 0;
-	    if (color0 != pcls->tile_colors[0] || color1 != pcls->tile_colors[1])
-		code = cmd_set_tile_colors(cdev, pcls, color0, color1);
-	    if (px != pcls->tile_phase.x || py != pcls->tile_phase.y) {
+	    if (color0 != re.pcls->tile_colors[0] || color1 != re.pcls->tile_colors[1])
+		code = cmd_set_tile_colors(cdev, re.pcls, color0, color1);
+	    if (px != re.pcls->tile_phase.x || py != re.pcls->tile_phase.y) {
 		if (code >= 0)
-		    code = cmd_set_tile_phase(cdev, pcls, px, py);
+		    code = cmd_set_tile_phase(cdev, re.pcls, px, py);
 	    }
 	    if (code >= 0)
-		code = cmd_write_rect_cmd(cdev, pcls, cmd_op_tile_rect, x, y,
-					  width, height);
+		code = cmd_write_rect_cmd(cdev, re.pcls, cmd_op_tile_rect, rx, re.y,
+					  rwidth, re.height);
 	} while (RECT_RECOVER(code));
 	/* HANDLE_RECT_UNLESS(code, 0); */
 	if (code < 0 && SET_BAND_CODE(code))
@@ -244,7 +246,7 @@
 int
 clist_copy_mono(gx_device * dev,
 		const byte * data, int data_x, int raster, gx_bitmap_id id,
-		int x, int y, int width, int height,
+		int rx, int ry, int rwidth, int rheight,
 		gx_color_index color0, gx_color_index color1)
 {
     gx_device_clist_writer * const cdev =
@@ -257,29 +259,30 @@
     bool uses_color = 
 	((color0 != gx_no_color_index) && (color0 != 0xffffff) && (color0 != 0)) ||
 	((color1 != gx_no_color_index) && (color1 != 0xffffff) && (color1 != 0));
+    cmd_rects_enum_t re;
 
 
-    fit_copy(dev, data, data_x, raster, id, x, y, width, height);
-    y0 = y;
+    fit_copy(dev, data, data_x, raster, id, rx, ry, rwidth, rheight);
+    y0 = ry;
     if (cdev->permanent_error < 0)
       return (cdev->permanent_error);
-    FOR_RECTS {
+    FOR_RECTS(re, ry, rheight) {
 	int dx = data_x & 7;
-	int w1 = dx + width;
-	const byte *row = data + (y - y0) * raster + (data_x >> 3);
+	int w1 = dx + rwidth;
+	const byte *row = data + (re.y - y0) * raster + (data_x >> 3);
 	int code;
 
-	pcls->colors_used.or |= colors_used;
-	pcls->band_complexity.uses_color |= uses_color;
+	re.pcls->colors_used.or |= colors_used;
+	re.pcls->band_complexity.uses_color |= uses_color;
 
 	do {
-	    code = cmd_disable_lop(cdev, pcls);
+	    code = cmd_disable_lop(cdev, re.pcls);
 	    if (code >= 0)
-		code = cmd_disable_clip(cdev, pcls);
-	    if (color0 != pcls->colors[0] && code >= 0)
-		code = cmd_set_color0(cdev, pcls, color0);
-	    if (color1 != pcls->colors[1] && code >= 0)
-		code = cmd_set_color1(cdev, pcls, color1);
+		code = cmd_disable_clip(cdev, re.pcls);
+	    if (color0 != re.pcls->colors[0] && code >= 0)
+		code = cmd_set_color0(cdev, re.pcls, color0);
+	    if (color1 != re.pcls->colors[1] && code >= 0)
+		code = cmd_set_color1(cdev, re.pcls, color1);
 	} while (RECT_RECOVER(code));
 	/* HANDLE_RECT_UNLESS(code, 0); */
 	if (code < 0 && SET_BAND_CODE(code))
@@ -295,11 +298,11 @@
 	uint compress;
 	int code;
 
-	rect.x = x, rect.y = y;
-	rect.width = w1, rect.height = height;
+	rect.x = rx, rect.y = re.y;
+	rect.width = w1, rect.height = re.height;
 	rsize = (dx ? 3 : 1) + cmd_size_rect(&rect);
 	do {
-	    code = cmd_put_bits(cdev, pcls, row, w1, height, raster,
+	    code = cmd_put_bits(cdev, re.pcls, row, w1, re.height, raster,
 				rsize, (orig_id == gx_no_bitmap_id ?
 					1 << cmd_compress_rle :
 					cmd_mask_compress_any),
@@ -311,12 +314,12 @@
 	compress = (uint)code;
 	if (code < 0) {
 	    /* The bitmap was too large; split up the transfer. */
-	    if (height > 1) {
+	    if (re.height > 1) {
 		/*
 		 * Split the transfer by reducing the height.
 		 * See the comment above FOR_RECTS in gxcldev.h.
 		 */
-		height >>= 1;
+		re.height >>= 1;
 		goto copy;
 	    } else {
 		/* Split a single (very long) row. */
@@ -325,12 +328,12 @@
 		++cdev->driver_call_nesting; /* NEST_RECT */ 
 		{
 		    code = clist_copy_mono(dev, row, dx,
-					   raster, gx_no_bitmap_id, x, y,
+					   raster, gx_no_bitmap_id, rx, re.y,
 					   w2, 1, color0, color1);
 		    if (code >= 0)
 			code = clist_copy_mono(dev, row, dx + w2,
 					       raster, gx_no_bitmap_id,
-					       x + w2, y,
+					       rx + w2, re.y,
 					       w1 - w2, 1, color0, color1);
 		} 
 		--cdev->driver_call_nesting; /* UNNEST_RECT */
@@ -345,9 +348,9 @@
 	    *dp++ = cmd_set_misc_data_x + dx;
 	}
 	*dp++ = cmd_count_op(op, csize);
-	cmd_put2w(x, y, dp);
-	cmd_put2w(w1, height, dp);
-	pcls->rect = rect;
+	cmd_put2w(rx, re.y, dp);
+	cmd_put2w(w1, re.height, dp);
+	re.pcls->rect = rect;
 	}
     } END_RECTS;
     return 0;
@@ -356,7 +359,7 @@
 int
 clist_copy_color(gx_device * dev,
 		 const byte * data, int data_x, int raster, gx_bitmap_id id,
-		 int x, int y, int width, int height)
+		 int rx, int ry, int rwidth, int rheight)
 {
     gx_device_clist_writer * const cdev =
 	&((gx_device_clist *)dev)->writer;
@@ -365,40 +368,41 @@
     int data_x_bit;
     /* We can't know what colors will be used: assume the worst. */
     gx_color_index colors_used = ((gx_color_index)1 << depth) - 1;
+    cmd_rects_enum_t re;
 
-    fit_copy(dev, data, data_x, raster, id, x, y, width, height);
-    y0 = y;
+    fit_copy(dev, data, data_x, raster, id, rx, ry, rwidth, rheight);
+    y0 = ry;
     data_x_bit = data_x * depth;
     if (cdev->permanent_error < 0)
       return (cdev->permanent_error);
-    FOR_RECTS {
+    FOR_RECTS(re, ry, rheight) {
 	int dx = (data_x_bit & 7) / depth;
-	int w1 = dx + width;
-	const byte *row = data + (y - y0) * raster + (data_x_bit >> 3);
+	int w1 = dx + rwidth;
+	const byte *row = data + (re.y - y0) * raster + (data_x_bit >> 3);
 	int code;
 
-	pcls->colors_used.or |= colors_used;
-	pcls->band_complexity.uses_color = 1;
+	re.pcls->colors_used.or |= colors_used;
+	re.pcls->band_complexity.uses_color = 1;
 
 	do {
-	    code = cmd_disable_lop(cdev, pcls);
+	    code = cmd_disable_lop(cdev, re.pcls);
 	    if (code >= 0)
-		code = cmd_disable_clip(cdev, pcls);
+		code = cmd_disable_clip(cdev, re.pcls);
 	} while (RECT_RECOVER(code));
 	/* HANDLE_RECT_UNLESS(code, 0); */
 	if (code < 0 && SET_BAND_CODE(code))
 	    goto error_in_rect;
-	if (pcls->color_is_alpha) {
+	if (re.pcls->color_is_alpha) {
 	    byte *dp;
 
 	    do {
 		code =
-		    set_cmd_put_op(dp, cdev, pcls, cmd_opv_set_copy_color, 1);
+		    set_cmd_put_op(dp, cdev, re.pcls, cmd_opv_set_copy_color, 1);
 	    } while (RECT_RECOVER(code));
 	    /* HANDLE_RECT_UNLESS(code, 0); */
 	    if (code < 0 && SET_BAND_CODE(code))
 		goto error_in_rect;
-	    pcls->color_is_alpha = 0;
+	    re.pcls->color_is_alpha = 0;
 	}
 copy:{
 	    gx_cmd_rect rect;
@@ -408,12 +412,12 @@
 	    uint csize;
 	    uint compress;
 
-	    rect.x = x, rect.y = y;
-	    rect.width = w1, rect.height = height;
+	    rect.x = rx, rect.y = re.y;
+	    rect.width = w1, rect.height = re.height;
 	    rsize = (dx ? 3 : 1) + cmd_size_rect(&rect);
 	    do {
-		code = cmd_put_bits(cdev, pcls, row, w1 * depth,
-				    height, raster, rsize,
+		code = cmd_put_bits(cdev, re.pcls, row, w1 * depth,
+				    re.height, raster, rsize,
 				    1 << cmd_compress_rle, &dp, &csize);
 	    } while (RECT_RECOVER(code));
 	    /* HANDLE_RECT_UNLESS(code, code == gs_error_limitcheck); */
@@ -422,11 +426,11 @@
 	    compress = (uint)code;
 	    if (code < 0) {
 		/* The bitmap was too large; split up the transfer. */
-		if (height > 1) {
+		if (re.height > 1) {
 		    /* Split the transfer by reducing the height.
 		     * See the comment above FOR_RECTS in gxcldev.h.
 		     */
-		    height >>= 1;
+		    re.height >>= 1;
 		    goto copy;
 		} else {
 		    /* Split a single (very long) row. */
@@ -436,11 +440,11 @@
 		    {
 			code = clist_copy_color(dev, row, dx,
 						raster, gx_no_bitmap_id,
-						x, y, w2, 1);
+						rx, re.y, w2, 1);
 			if (code >= 0)
 			    code = clist_copy_color(dev, row, dx + w2,
 						    raster, gx_no_bitmap_id,
-						    x + w2, y, w1 - w2, 1);
+						    rx + w2, re.y, w1 - w2, 1);
 		    } 
 		    --cdev->driver_call_nesting; /* UNNEST_RECT */
 		    if (code < 0 && SET_BAND_CODE(code))
@@ -454,9 +458,9 @@
 		*dp++ = cmd_set_misc_data_x + dx;
 	    }
 	    *dp++ = cmd_count_op(op, csize);
-	    cmd_put2w(x, y, dp);
-	    cmd_put2w(w1, height, dp);
-	    pcls->rect = rect;
+	    cmd_put2w(rx, re.y, dp);
+	    cmd_put2w(w1, re.height, dp);
+	    re.pcls->rect = rect;
 	}
     } END_RECTS;
     return 0;
@@ -464,7 +468,7 @@
 
 int
 clist_copy_alpha(gx_device * dev, const byte * data, int data_x,
-	   int raster, gx_bitmap_id id, int x, int y, int width, int height,
+	   int raster, gx_bitmap_id id, int rx, int ry, int rwidth, int rheight,
 		 gx_color_index color, int depth)
 {
     gx_device_clist_writer * const cdev =
@@ -476,46 +480,47 @@
     int log2_depth = ilog2(depth);
     int y0;
     int data_x_bit;
+    cmd_rects_enum_t re;
 
     /* If the target can't perform copy_alpha, exit now */
     if (depth > 1 && (cdev->disable_mask & clist_disable_copy_alpha) != 0)
 	return_error(gs_error_unknownerror);
 
-    fit_copy(dev, data, data_x, raster, id, x, y, width, height);
-    y0 = y;
+    fit_copy(dev, data, data_x, raster, id, rx, ry, rwidth, rheight);
+    y0 = ry;
     data_x_bit = data_x << log2_depth;
     if (cdev->permanent_error < 0)
       return (cdev->permanent_error);
-    FOR_RECTS {
+    FOR_RECTS(re, ry, rheight) {
 	int dx = (data_x_bit & 7) >> log2_depth;
-	int w1 = dx + width;
-	const byte *row = data + (y - y0) * raster + (data_x_bit >> 3);
+	int w1 = dx + rwidth;
+	const byte *row = data + (re.y - y0) * raster + (data_x_bit >> 3);
 	int code;
 
-	pcls->colors_used.or |= color;
+	re.pcls->colors_used.or |= color;
 	do {
-	    code = cmd_disable_lop(cdev, pcls);
+	    code = cmd_disable_lop(cdev, re.pcls);
 	    if (code >= 0)
-		code = cmd_disable_clip(cdev, pcls);
+		code = cmd_disable_clip(cdev, re.pcls);
 	} while (RECT_RECOVER(code));
 	/* HANDLE_RECT_UNLESS(code, 0); */
 	if (code < 0 && SET_BAND_CODE(code))
 	    goto error_in_rect;
-	if (!pcls->color_is_alpha) {
+	if (!re.pcls->color_is_alpha) {
 	    byte *dp;
 
 	    do {
 		code =
-		    set_cmd_put_op(dp, cdev, pcls, cmd_opv_set_copy_alpha, 1);
+		    set_cmd_put_op(dp, cdev, re.pcls, cmd_opv_set_copy_alpha, 1);
 	    } while (RECT_RECOVER(code));
 	    /* HANDLE_RECT_UNLESS(code, 0); */
 	    if (code < 0 && SET_BAND_CODE(code))
 		goto error_in_rect;
-	    pcls->color_is_alpha = 1;
+	    re.pcls->color_is_alpha = 1;
 	}
-	if (color != pcls->colors[1]) {
+	if (color != re.pcls->colors[1]) {
 	    do {
-		code = cmd_set_color1(cdev, pcls, color);
+		code = cmd_set_color1(cdev, re.pcls, color);
 	    } while (RECT_RECOVER(code));
 	    /* HANDLE_RECT_UNLESS(code, 0); */
 	    if (code < 0 && SET_BAND_CODE(code))
@@ -529,12 +534,12 @@
 	    uint csize;
 	    uint compress;
 
-	    rect.x = x, rect.y = y;
-	    rect.width = w1, rect.height = height;
+	    rect.x = rx, rect.y = re.y;
+	    rect.width = w1, rect.height = re.height;
 	    rsize = (dx ? 4 : 2) + cmd_size_rect(&rect);
 	    do {
-		code = cmd_put_bits(cdev, pcls, row, w1 << log2_depth,
-				    height, raster, rsize,
+		code = cmd_put_bits(cdev, re.pcls, row, w1 << log2_depth,
+				    re.height, raster, rsize,
 				    1 << cmd_compress_rle, &dp, &csize);
 	    } while (RECT_RECOVER(code));
 	    /* HANDLE_RECT_UNLESS(code, code == gs_error_limitcheck); */
@@ -543,11 +548,11 @@
 	    compress = (uint)code;
 	    if (code < 0) {
 		/* The bitmap was too large; split up the transfer. */
-		if (height > 1) {
+		if (re.height > 1) {
 		    /* Split the transfer by reducing the height.
 		     * See the comment above FOR_RECTS in gxcldev.h.
 		     */
-		    height >>= 1;
+		    re.height >>= 1;
 		    goto copy;
 		} else {
 		    /* Split a single (very long) row. */
@@ -556,12 +561,12 @@
 		    ++cdev->driver_call_nesting; /* NEST_RECT */ 
 		    {
 			code = clist_copy_alpha(dev, row, dx,
-						raster, gx_no_bitmap_id, x, y,
+						raster, gx_no_bitmap_id, rx, re.y,
 						w2, 1, color, depth);
 			if (code >= 0)
 			    code = clist_copy_alpha(dev, row, dx + w2,
 						    raster, gx_no_bitmap_id,
-						    x + w2, y, w1 - w2, 1,
+						    rx + w2, re.y, w1 - w2, 1,
 						    color, depth);
 		    } 
 		    --cdev->driver_call_nesting; /* UNNEST_RECT */
@@ -577,9 +582,9 @@
 	    }
 	    *dp++ = cmd_count_op(op, csize);
 	    *dp++ = depth;
-	    cmd_put2w(x, y, dp);
-	    cmd_put2w(w1, height, dp);
-	    pcls->rect = rect;
+	    cmd_put2w(rx, re.y, dp);
+	    cmd_put2w(w1, re.height, dp);
+	    re.pcls->rect = rect;
 	}
     } END_RECTS;
     return 0;
@@ -590,7 +595,7 @@
 	     const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
 		     const gx_color_index * scolors,
 	   const gx_strip_bitmap * textures, const gx_color_index * tcolors,
-		     int x, int y, int width, int height,
+		     int rx, int ry, int rwidth, int rheight,
 		     int phase_x, int phase_y, gs_logical_operation_t lop)
 {
     gx_device_clist_writer * const cdev =
@@ -609,11 +614,12 @@
     gs_rop3_t color_rop =
 	(subtractive ? byte_reverse_bits[rop ^ 0xff] : rop);
     bool slow_rop;
+    cmd_rects_enum_t re;
 
     if (scolors != 0 && scolors[0] != scolors[1]) {
-	fit_fill(dev, x, y, width, height);
+	fit_fill(dev, rx, ry, rwidth, rheight);
     } else {
-	fit_copy(dev, sdata, sourcex, sraster, id, x, y, width, height);
+	fit_copy(dev, sdata, sourcex, sraster, id, rx, ry, rwidth, rheight);
     }
     /*
      * On CMYK devices, RasterOps must be executed with complete pixels
@@ -637,29 +643,29 @@
 	slow_rop = !(rop == rop3_0 || rop == rop3_1 || 
                      rop == rop3_S || rop == rop3_T);
     }
-    y0 = y;
+    y0 = ry;
     /*
      * We shouldn't need to put the logic below inside FOR/END_RECTS,
      * but the lop_enabled flags are per-band.
      */
     if (cdev->permanent_error < 0)
       return (cdev->permanent_error);
-    FOR_RECTS {
-	const byte *row = sdata + (y - y0) * sraster;
-	gx_color_index D = pcls->colors_used.or;
+    FOR_RECTS(re, ry, rheight) {
+	const byte *row = sdata + (re.y - y0) * sraster;
+	gx_color_index D = re.pcls->colors_used.or;
 	int code;
 
 	/* Reducing D, S, T to rop_operand (which apparently is 32 bit) appears safe
 	   due to 'all' a has smaller snumber of significant bits. */
-	pcls->colors_used.or =
+	re.pcls->colors_used.or =
 	    ((rop_proc_table[color_rop])((rop_operand)D, (rop_operand)S, (rop_operand)T) & all) | D;
-	pcls->colors_used.slow_rop |= slow_rop;
-	pcls->band_complexity.nontrivial_rops |= slow_rop;
+	re.pcls->colors_used.slow_rop |= slow_rop;
+	re.pcls->band_complexity.nontrivial_rops |= slow_rop;
 	if (rop3_uses_T(rop)) {
 	    if (tcolors == 0 || tcolors[0] != tcolors[1]) {
 		ulong offset_temp;
 
-		if (!cls_has_tile_id(cdev, pcls, tiles->id, offset_temp)) {
+		if (!cls_has_tile_id(cdev, re.pcls, tiles->id, offset_temp)) {
 		    /* Change tile.  If there is no id, generate one. */
 		    if (tiles->id == gx_no_bitmap_id) {
 			tile_with_id = *tiles;
@@ -667,7 +673,7 @@
 			tiles = &tile_with_id;
 		    }
 		    do {
-			code = clist_change_tile(cdev, pcls, tiles,
+			code = clist_change_tile(cdev, re.pcls, tiles,
 						 (tcolors != 0 ? 1 :
 						  dev->color_info.depth));
 		    } while (RECT_RECOVER(code));
@@ -697,13 +703,13 @@
 			 * Allocate enough fake IDs, since the inner call on
 			 * clist_strip_copy_rop will need them anyway.
 			 */
-			ids = gs_next_ids(dev->memory, min(height, rep_height));
+			ids = gs_next_ids(dev->memory, min(re.height, rep_height));
 			line_tile = *tiles;
 			line_tile.size.y = 1;
 			line_tile.rep_height = 1;
-			for (iy = 0; iy < height; ++iy) {
+			for (iy = 0; iy < re.height; ++iy) {
 			    line_tile.data = tiles->data + line_tile.raster *
-				((y + iy + phase_y) % rep_height);
+				((re.y + iy + phase_y) % rep_height);
 			    line_tile.id = ids + (iy % rep_height);
 			    /*
 			     * Note that since we're only transferring
@@ -718,8 +724,8 @@
 					sourcex, sraster,
 					gx_no_bitmap_id, scolors,
 					&line_tile, tcolors,
-					x, y + iy, width, 1,
-					phase_x, pcls->tile_phase.y, lop);
+					rx, re.y + iy, rwidth, 1,
+					phase_x, re.pcls->tile_phase.y, lop);
 			    } 
 			    --cdev->driver_call_nesting; /* UNNEST_RECT */
 			    if (code < 0 && SET_BAND_CODE(code))
@@ -727,11 +733,11 @@
 			}
 			continue;
 		    }
-		    if (phase_x != pcls->tile_phase.x ||
-			phase_y != pcls->tile_phase.y
+		    if (phase_x != re.pcls->tile_phase.x ||
+			phase_y != re.pcls->tile_phase.y
 			) {
 			do {
-			    code = cmd_set_tile_phase(cdev, pcls, phase_x,
+			    code = cmd_set_tile_phase(cdev, re.pcls, phase_x,
 						      phase_y);
 			} while (RECT_RECOVER(code));
 			/* HANDLE_RECT_UNLESS(code, 0); */
@@ -744,8 +750,8 @@
 	    do {
 		code =
 		    (tcolors != 0 ?
-		     cmd_set_tile_colors(cdev, pcls, tcolors[0], tcolors[1]) :
-		     cmd_set_tile_colors(cdev, pcls, gx_no_color_index,
+		     cmd_set_tile_colors(cdev, re.pcls, tcolors[0], tcolors[1]) :
+		     cmd_set_tile_colors(cdev, re.pcls, gx_no_color_index,
 					 gx_no_color_index));
 	    } while (RECT_RECOVER(code));
 	    /* HANDLE_RECT_UNLESS(code, 0); */
@@ -754,33 +760,33 @@
 	}
 	do {
 	    code = 0;
-	    if (lop != pcls->lop)
-		code = cmd_set_lop(cdev, pcls, lop);
+	    if (lop != re.pcls->lop)
+		code = cmd_set_lop(cdev, re.pcls, lop);
 	    if (code >= 0)
-		code = cmd_enable_lop(cdev, pcls);
+		code = cmd_enable_lop(cdev, re.pcls);
 	} while (RECT_RECOVER(code));
 	/* HANDLE_RECT_UNLESS(code, 0); */
 	if (code < 0 && SET_BAND_CODE(code))
 	    goto error_in_rect;
 	/* Set lop_enabled to -1 so that fill_rectangle / copy_* */
 	/* won't attempt to set it to 0. */
-	pcls->lop_enabled = -1;
+	re.pcls->lop_enabled = -1;
 	++cdev->driver_call_nesting; /* NEST_RECT */ 
 	{
 	    if (scolors != 0) {
 		if (scolors[0] == scolors[1])
-		    code = clist_fill_rectangle(dev, x, y, width, height,
+		    code = clist_fill_rectangle(dev, rx, re.y, rwidth, re.height,
 						scolors[1]);
 		else
 		    code = clist_copy_mono(dev, row, sourcex, sraster, id,
-					   x, y, width, height,
+					   rx, re.y, rwidth, re.height,
 					   scolors[0], scolors[1]);
 	    } else
 		code = clist_copy_color(dev, row, sourcex, sraster, id,
-					x, y, width, height);
+					rx, re.y, rwidth, re.height);
 	} 
 	--cdev->driver_call_nesting; /* UNNEST_RECT */
-	pcls->lop_enabled = 1;
+	re.pcls->lop_enabled = 1;
 	if (code < 0 && SET_BAND_CODE(code))
 	    goto error_in_rect;
     } END_RECTS;



More information about the gs-cvs mailing list