[gs-cvs] rev 8086 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Fri Jun 29 07:54:21 PDT 2007
Author: leonardo
Date: 2007-06-29 07:54:20 -0700 (Fri, 29 Jun 2007)
New Revision: 8086
Modified:
trunk/gs/src/gxcldev.h
trunk/gs/src/gxclimag.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-29 09:28:27 UTC (rev 8085)
+++ trunk/gs/src/gxcldev.h 2007-06-29 14:54:20 UTC (rev 8086)
@@ -568,40 +568,41 @@
int band_end;
} cmd_rects_enum_t;
-#define FOR_RECTS(re, yvar, heightvar)\
- BEGIN\
+#define RECT_ENUM_INIT(re, yvar, heightvar)\
re.y = yvar;\
re.height = heightvar;\
re.yend = re.y + re.height;\
- re.band_height = cdev->page_band_height;\
- do {\
+ re.band_height = cdev->page_band_height;
+
+#define RECT_STEP_INIT(re)\
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;\
+ 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_ON_ERROR(retry_cleanup, is_error, after_recovering)\
+
+#define END_RECTS\
continue;\
error_in_rect:\
- if (cdev->error_is_retryable) {\
- retry_cleanup;\
- if ((is_error) &&\
- cdev->driver_call_nesting == 0 &&\
- SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0 &&\
- (after_recovering)\
- )\
- goto retry_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
-#define END_RECTS END_RECTS_ON_ERROR(DO_NOTHING, 1, 1)
+
/* ------ 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 09:28:27 UTC (rev 8085)
+++ trunk/gs/src/gxclimag.c 2007-06-29 14:54:20 UTC (rev 8086)
@@ -636,13 +636,16 @@
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
- FOR_RECTS(re, ry, rheight) {
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
+ gs_int_rect ibox;
+ gs_int_rect entire_box;
+
+ RECT_STEP_INIT(re);
/*
* Just transmit the subset of the data that intersects this band.
* Note that y and height always define a complete band.
*/
- gs_int_rect ibox;
- gs_int_rect entire_box;
if (!image_band_box(dev, pie, re.y, re.height, &ibox))
continue;
@@ -783,14 +786,25 @@
offsets[i] += planes[i].raster * nrows;
}
}
- } END_RECTS_ON_ERROR(
- code = clist_image_plane_data_retry_cleanup(dev, pie, yh_used, code),
- (code < 0 ? SET_BAND_CODE(code) : code) >= 0,
- (cmd_clear_known(cdev,
- clist_image_unknowns(dev, pie) | begin_image_known),
- pie->color_map_is_known = false,
- cdev->image_enum_id = pie->id, true)
- );
+ continue;
+error_in_rect:
+ if (cdev->error_is_retryable) {
+ code = clist_image_plane_data_retry_cleanup(dev, pie, yh_used, code);
+ if (code < 0)
+ SET_BAND_CODE(code);
+ else if (cdev->driver_call_nesting == 0) {
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code));
+ if (re.band_code >= 0) {
+ cmd_clear_known(cdev, clist_image_unknowns(dev, pie) | begin_image_known);
+ pie->color_map_is_known = false;
+ cdev->image_enum_id = pie->id;
+ re.y -= re.height; /* Retry rect. */
+ continue;
+ }
+ }
+ }
+ return re.band_code;
+ } while ((re.y += re.height) < re.yend);
done:
*rows_used = pie->y - y_orig;
return pie->y >= pie->rect.q.y;
More information about the gs-cvs
mailing list