[gs-cvs] rev 8087 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Fri Jun 29 08:38:28 PDT 2007
Author: leonardo
Date: 2007-06-29 08:38:25 -0700 (Fri, 29 Jun 2007)
New Revision: 8087
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 5.
DETAILS :
This change is algorithmically equivalent.
The purpose is to eliminate gxcldev.h macros
to simplify the debugging of the clist writer methods.
This 5th step eliminates FOR_RECTS and END_RECTS macros.
So now all control flow statements are outside macros.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gxcldev.h
===================================================================
--- trunk/gs/src/gxcldev.h 2007-06-29 14:54:20 UTC (rev 8086)
+++ trunk/gs/src/gxcldev.h 2007-06-29 15:38:25 UTC (rev 8087)
@@ -580,29 +580,10 @@
re.band_end = (re.band + 1) * re.band_height;\
re.height = min(re.band_end, re.yend) - re.y;
-#define FOR_RECTS(re, yvar, heightvar)\
- BEGIN\
- RECT_ENUM_INIT(re, yvar, heightvar);\
- do {\
- RECT_STEP_INIT(re);\
-retry_rect:\
- ;
#define RECT_RECOVER(codevar) (codevar < 0 && (codevar = clist_VMerror_recover(cdev, codevar)) >= 0)
#define SET_BAND_CODE(codevar) (re.band_code = codevar)
-
-#define END_RECTS\
- continue;\
-error_in_rect:\
- if (cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&\
- SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0)\
- goto retry_rect;\
- return re.band_code;\
- } while ((re.y += re.height) < re.yend);\
- END
-
-
/* ------ Exported by gxclrect.c ------ */
/* Put out a fill or tile rectangle command. */
Modified: trunk/gs/src/gxclimag.c
===================================================================
--- trunk/gs/src/gxclimag.c 2007-06-29 14:54:20 UTC (rev 8086)
+++ trunk/gs/src/gxclimag.c 2007-06-29 15:38:25 UTC (rev 8087)
@@ -105,10 +105,13 @@
data_x_bit = data_x << log2_depth;
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
- FOR_RECTS(re, ry, rheight) {
- int code;
- ulong offset_temp;
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
+ int code;
+ ulong offset_temp;
+ RECT_STEP_INIT(re);
+retry_rect:
do {
code = cmd_update_lop(cdev, re.pcls, lop);
} while (RECT_RECOVER(code));
@@ -205,9 +208,14 @@
goto end;
}
end:
- ;
- } END_RECTS;
- return 0;
+ continue;
+error_in_rect:
+ if (cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0)
+ goto retry_rect;
+ return re.band_code;
+ } while ((re.y += re.height) < re.yend);
+ return 0;
}
/* ------ Bitmap image driver procedures ------ */
@@ -1479,9 +1487,12 @@
return 0;
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
- FOR_RECTS(re, ry, rheight) {
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
byte *dp;
+ RECT_STEP_INIT(re);
+retry_rect:
if (!(re.pcls->known & begin_image_known))
continue;
do {
@@ -1493,7 +1504,13 @@
goto error_in_rect;
dp[1] = 0; /* EOD */
re.pcls->known ^= begin_image_known;
- } END_RECTS;
+ continue;
+error_in_rect:
+ if (cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0)
+ goto retry_rect;
+ return re.band_code;
+ } while ((re.y += re.height) < re.yend);
return 0;
}
Modified: trunk/gs/src/gxclpath.c
===================================================================
--- trunk/gs/src/gxclpath.c 2007-06-29 14:54:20 UTC (rev 8086)
+++ trunk/gs/src/gxclpath.c 2007-06-29 15:38:25 UTC (rev 8087)
@@ -605,9 +605,12 @@
cmd_clear_known(cdev, unknown);
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
- FOR_RECTS(re, ry, rheight) {
- int code = cmd_do_write_unknown(cdev, re.pcls, FILL_KNOWN);
-
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
+ int code;
+ RECT_STEP_INIT(re);
+retry_rect:
+ code = cmd_do_write_unknown(cdev, re.pcls, FILL_KNOWN);
if (code < 0)
return code;
if ((code = cmd_do_enable_clip(cdev, re.pcls, pcpath != NULL)) < 0 ||
@@ -628,7 +631,13 @@
true, sn_none /* fill doesn't need the notes */ );
if (code < 0)
return code;
- } END_RECTS;
+ continue;
+error_in_rect:
+ if (cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0)
+ goto retry_rect;
+ return re.band_code;
+ } while ((re.y += re.height) < re.yend);
return 0;
}
@@ -739,8 +748,11 @@
cmd_clear_known(cdev, unknown);
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
- FOR_RECTS(re, ry, rheight) {
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
int code;
+ RECT_STEP_INIT(re);
+retry_rect:
if ((code = cmd_do_write_unknown(cdev, re.pcls, stroke_all_known)) < 0 ||
(code = cmd_do_enable_clip(cdev, re.pcls, pcpath != NULL)) < 0 ||
@@ -777,7 +789,13 @@
if (code < 0)
return code;
}
- } END_RECTS;
+ continue;
+error_in_rect:
+ if (cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0)
+ goto retry_rect;
+ return re.band_code;
+ } while ((re.y += re.height) < re.yend);
return 0;
}
@@ -821,7 +839,10 @@
y1 = ry + rheight;
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
- FOR_RECTS(re, ry, rheight) {
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
+ RECT_STEP_INIT(re);
+retry_rect:
if ((code = cmd_update_lop(cdev, re.pcls, lop)) < 0 ||
(code = cmd_put_drawing_color(cdev, re.pcls, pdcolor)) < 0)
goto out;
@@ -833,7 +854,13 @@
true, sn_none /* fill doesn't need the notes */ );
if (code < 0)
goto out;
- } END_RECTS;
+ continue;
+error_in_rect:
+ if (cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0)
+ goto retry_rect;
+ return re.band_code;
+ } while ((re.y += re.height) < re.yend);
out:
gx_path_free(&path, "clist_put_polyfill");
return code;
Modified: trunk/gs/src/gxclrect.c
===================================================================
--- trunk/gs/src/gxclrect.c 2007-06-29 14:54:20 UTC (rev 8086)
+++ trunk/gs/src/gxclrect.c 2007-06-29 15:38:25 UTC (rev 8087)
@@ -146,7 +146,10 @@
fit_fill(dev, rx, ry, rwidth, rheight);
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
- FOR_RECTS(re, ry, rheight) {
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
+ RECT_STEP_INIT(re);
+retry_rect:
re.pcls->colors_used.or |= color;
re.pcls->band_complexity.uses_color |= ((color != 0xffffff) && (color != 0));
do {
@@ -161,7 +164,13 @@
/* HANDLE_RECT_UNLESS(code, 0); */
if (code < 0 && SET_BAND_CODE(code))
goto error_in_rect;
- } END_RECTS;
+ continue;
+error_in_rect:
+ if (cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0)
+ goto retry_rect;
+ return re.band_code;
+ } while ((re.y += re.height) < re.yend);
return 0;
}
@@ -187,9 +196,12 @@
fit_fill(dev, rx, ry, rwidth, rheight);
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
- FOR_RECTS(re, ry, rheight) {
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
ulong offset_temp;
+ RECT_STEP_INIT(re);
+retry_rect:
re.pcls->colors_used.or |= colors_used;
re.pcls->band_complexity.uses_color |=
((color0 != gx_no_color_index) && (color0 != 0xffffff) && (color0 != 0)) ||
@@ -239,7 +251,13 @@
if (code < 0 && SET_BAND_CODE(code))
goto error_in_rect;
endr:;
- } END_RECTS;
+ continue;
+error_in_rect:
+ if (cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0)
+ goto retry_rect;
+ return re.band_code;
+ } while ((re.y += re.height) < re.yend);
return 0;
}
@@ -266,15 +284,17 @@
y0 = ry;
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
- FOR_RECTS(re, ry, rheight) {
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
int dx = data_x & 7;
int w1 = dx + rwidth;
const byte *row = data + (re.y - y0) * raster + (data_x >> 3);
int code;
+ RECT_STEP_INIT(re);
+retry_rect:
re.pcls->colors_used.or |= colors_used;
re.pcls->band_complexity.uses_color |= uses_color;
-
do {
code = cmd_disable_lop(cdev, re.pcls);
if (code >= 0)
@@ -352,7 +372,13 @@
cmd_put2w(w1, re.height, dp);
re.pcls->rect = rect;
}
- } END_RECTS;
+ continue;
+error_in_rect:
+ if (cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0)
+ goto retry_rect;
+ return re.band_code;
+ } while ((re.y += re.height) < re.yend);
return 0;
}
@@ -375,12 +401,15 @@
data_x_bit = data_x * depth;
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
- FOR_RECTS(re, ry, rheight) {
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
int dx = (data_x_bit & 7) / depth;
int w1 = dx + rwidth;
const byte *row = data + (re.y - y0) * raster + (data_x_bit >> 3);
int code;
+ RECT_STEP_INIT(re);
+retry_rect:
re.pcls->colors_used.or |= colors_used;
re.pcls->band_complexity.uses_color = 1;
@@ -462,7 +491,13 @@
cmd_put2w(w1, re.height, dp);
re.pcls->rect = rect;
}
- } END_RECTS;
+ continue;
+error_in_rect:
+ if (cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0)
+ goto retry_rect;
+ return re.band_code;
+ } while ((re.y += re.height) < re.yend);
return 0;
}
@@ -491,12 +526,15 @@
data_x_bit = data_x << log2_depth;
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
- FOR_RECTS(re, ry, rheight) {
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
int dx = (data_x_bit & 7) >> log2_depth;
int w1 = dx + rwidth;
const byte *row = data + (re.y - y0) * raster + (data_x_bit >> 3);
int code;
+ RECT_STEP_INIT(re);
+retry_rect:
re.pcls->colors_used.or |= color;
do {
code = cmd_disable_lop(cdev, re.pcls);
@@ -586,7 +624,13 @@
cmd_put2w(w1, re.height, dp);
re.pcls->rect = rect;
}
- } END_RECTS;
+ continue;
+error_in_rect:
+ if (cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0)
+ goto retry_rect;
+ return re.band_code;
+ } while ((re.y += re.height) < re.yend);
return 0;
}
@@ -644,17 +688,17 @@
rop == rop3_S || rop == rop3_T);
}
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(re, ry, rheight) {
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
const byte *row = sdata + (re.y - y0) * sraster;
- gx_color_index D = re.pcls->colors_used.or;
+ gx_color_index D;
int code;
+ RECT_STEP_INIT(re);
+ D = re.pcls->colors_used.or;
+retry_rect:
/* Reducing D, S, T to rop_operand (which apparently is 32 bit) appears safe
due to 'all' a has smaller snumber of significant bits. */
re.pcls->colors_used.or =
@@ -789,6 +833,12 @@
re.pcls->lop_enabled = 1;
if (code < 0 && SET_BAND_CODE(code))
goto error_in_rect;
- } END_RECTS;
+ continue;
+error_in_rect:
+ if (cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0)
+ goto retry_rect;
+ return re.band_code;
+ } while ((re.y += re.height) < re.yend);
return 0;
}
More information about the gs-cvs
mailing list