summaryrefslogtreecommitdiff
path: root/gs/src/gdevdbit.c
diff options
context:
space:
mode:
authorDan Coby <dan.coby@artifex.com>2002-08-26 23:00:07 +0000
committerDan Coby <dan.coby@artifex.com>2002-08-26 23:00:07 +0000
commit63e81dbdaa4292eb78a17463e76abb77f87394b9 (patch)
tree38e2758d10bbcadcd5a5726eebc1792f195a041a /gs/src/gdevdbit.c
parentd5d2f3dffb2f9b56d197d15f49569e1d7e73edf1 (diff)
Modified files:
src/gdevdbit.c: Changed gx_default_fill_mask to use the fill_masked routine of the device color. This avoids an instance in which a possibly uninitialized halftone tile is used for drawing. It also makes the code considerably cleaner. src/gscdefs.h Re-installed the definition of extern_gs_find_compositor, which had in-advertently been lost in a recent code merge. src/gsdcolor.h Added the colors.binary.b_level field to the gx_device_color_saved structure. Also added a comment explaining why this structure is used rather than the gx_device_color structure itself. src/gsht.c This file should be identical to the version released on Aug. 22nd. We are releasing again here just to guard against this code being committed without the former change. src/gsht1.c Modified the check for "binaryness" of a device color model in gs_sethalftone_try_wts to handle cases in which not all of the depth bits are used. src/gstext.c, src/gxtext.h src/zchar.c These files are identical to the set released on Aug. 23rd (the fix for color changes in a kshow procedure). We are releasing them again here to make certain the rest of this code is not committed without the former change. src/gxacpath.c Modified gx_cpath_accum_end to set the new bbox_accurate field rather than the bbox_set field. This avoids overloading the bbox_set field in a way that can lead to inconsistent output when the setbbox operator is used with a path. src/gxcht.c src/gxht.c src/gxdcolor.c src/gxdcolor.h Modified the "write" methods for various color spaces so that their return value can indicate that the operand and last transmitted colors are the same. Also fixed various bugs uncovered when the modular device color serialization/de-serialization was first used. The changes to gxdcolor.h involve only comments. src/gxcldev.h 1. Added a saved device color (gx_device_color_saved) to the band state structure. 2. Removed the (long since unnecessary) type operand from the cmd_put_halftone procedure. 3. Commented out some now obsolete command codes. src/gxclimag.c 1. Modified clist_fill_mask to work with the new, modular drawing color serialization/de-serialization routines. 2. Rewrote cmd_put_halftone as required by the new mechanism for serializing/de-serializing device halftones. 3. Modified various invocations of cmd_put_halftone to discard the the type operand. Note: The existing code impose a requirement that image objects that used a device color (e.g.: image masks) would only be passed through the command list if that color is pure. We do not know why this limitation was necessary, and suspect it is no longer necessary, but we have left it in place for now. src/gxclist.c Added gxdcolor.h to the included file list. src/gxclpath.c 1. Rewrote cmd_put_drawing_color to use the new mechanism for serialization/de-serialization of device colors. 2. Removed the device color type information from the stroke/ fill/polyfill commands. 3. Modified cmd_put_path so that "moveto closepath" is not passed through the command list as just "moveto". src/gxclpath.h 1. Added the cmd_opv_ext_put_ht_seg, to allow device halftones to be split across multiple command buffers. Also added the macro cbuf_ht_seg_max_size, to indicate the largest halftone segment to be put in a single command buffer. 2. Commented out some now obsolete command codes. src/gxclrast.c 1. Modified the code to read device halftones and device colors to use the new serialization/de-serialization methods for these structures. 2. Modified various locations in which partial/temporary device colors are used to use the current color for the band. 3. Removed code for the various stroke/fill/polyfill commands that encode device color type as part of the command. 4. Added code to save the current color when a pure color must be set to generate a clip region using the fill procedure. 5. Modified the clip path reading code to flatten the clip path before passing it to the fill operation. This is necessary to ensure consistent results between the banded and non-banded cases (the non-banded case also flattens a clip path before passing it to the fill operation). src/gxdhtserial.c 1. Updated gx_ht_read_tf and gx_ht_read_and_install to properly use the reference count in a transfer function. 2. Fixed various other errors discovered when this code was first used. src/gxdhtserial.h Fixed typo. src/gxpath.c Initialize the new bbox_accurate field of the gx_path structure to false in gx_path_init_contents. src/gxpath2.c Modified gx_path_bbox to use the bbox_accurate rather than bbox_set field to determine if the bounding box of a path needs to be explicitly calculated. If bbox_set is true, the bounding box in the bbox field will contain the current path, but may be larger than necessary. Due to a problem in the clip/fill code, the larger bounding box may generate slightly inconsistent results. src/gzpath.h Added the bbox_accurate field to the gx_path_s structure. This field is used by the clip accumulator device, which avoids the need to overload the bbox_set field (which is also used by the setbbox operator). src/lib.mak Updated varius dependency lists. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@2934 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs/src/gdevdbit.c')
-rw-r--r--gs/src/gdevdbit.c101
1 files changed, 6 insertions, 95 deletions
diff --git a/gs/src/gdevdbit.c b/gs/src/gdevdbit.c
index aae5bc656..a91bcd9f0 100644
--- a/gs/src/gdevdbit.c
+++ b/gs/src/gdevdbit.c
@@ -14,7 +14,7 @@
San Rafael, CA 94903, U.S.A., +1(415)492-9861.
*/
-/* $Id$ */
+/*$Id$ */
/* Default device bitmap copying implementation */
#include "gx.h"
#include "gpcheck.h"
@@ -300,19 +300,7 @@ gx_default_fill_mask(gx_device * orig_dev,
{
gx_device *dev;
gx_device_clip cdev;
- gx_color_index colors[2];
- gx_strip_bitmap *tile;
-
- if (gx_dc_is_pure(pdcolor)) {
- tile = 0;
- colors[0] = gx_no_color_index;
- colors[1] = gx_dc_pure_color(pdcolor);
- } else if (gx_dc_is_binary_halftone(pdcolor)) {
- tile = gx_dc_binary_tile(pdcolor);
- colors[0] = gx_dc_binary_color0(pdcolor);
- colors[1] = gx_dc_binary_color1(pdcolor);
- } else
- return_error(gs_error_unknownerror); /* not implemented */
+
if (pcpath != 0) {
gx_make_clip_path_device(&cdev, pcpath);
cdev.target = orig_dev;
@@ -323,88 +311,11 @@ gx_default_fill_mask(gx_device * orig_dev,
if (depth > 1) {
/****** CAN'T DO ROP OR HALFTONE WITH ALPHA ******/
return (*dev_proc(dev, copy_alpha))
- (dev, data, dx, raster, id, x, y, w, h, colors[1], depth);
- }
- if (lop != lop_default) {
- gx_color_index scolors[2];
-
- scolors[0] = gx_device_white(dev);
- scolors[1] = gx_device_black(dev);
- if (tile == 0)
- colors[0] = colors[1]; /* pure color */
- /*
- * We want to write only where the mask is a 1, so enable source
- * transparency. We have to include S in the operation,
- * otherwise S_transparent will be ignored.
- */
- return (*dev_proc(dev, strip_copy_rop))
- (dev, data, dx, raster, id, scolors, tile, colors,
- x, y, w, h,
- gx_dc_phase(pdcolor).x, gx_dc_phase(pdcolor).y,
- lop | (rop3_S | lop_S_transparent));
- }
- if (tile == 0) {
- return (*dev_proc(dev, copy_mono))
(dev, data, dx, raster, id, x, y, w, h,
- gx_no_color_index, colors[1]);
- }
- /*
- * Use the same approach as the default copy_mono (above). We
- * should really clip to the intersection of the bounding boxes of
- * the device and the clipping path, but it's too much work.
- */
- fit_copy(orig_dev, data, dx, raster, id, x, y, w, h);
- {
- dev_proc_strip_tile_rectangle((*tile_proc)) =
- dev_proc(dev, strip_tile_rectangle);
- const byte *row = data + (dx >> 3);
- int dx_bit = dx & 7;
- int wdx = w + dx_bit;
- int iy;
-
- for (row = data, iy = 0; iy < h; row += raster, iy++) {
- int ix;
-
- for (ix = dx_bit; ix < wdx;) {
- int i0;
- uint b;
- uint len;
- int code;
-
- /* Skip 0-bits. */
- b = row[ix >> 3];
- len = byte_bit_run_length[ix & 7][b ^ 0xff];
- if (len) {
- ix += ((len - 1) & 7) + 1;
- continue;
- }
- /* Scan 1-bits. */
- i0 = ix;
- for (;;) {
- b = row[ix >> 3];
- len = byte_bit_run_length[ix & 7][b];
- if (!len)
- break;
- ix += ((len - 1) & 7) + 1;
- if (ix >= wdx) {
- ix = wdx;
- break;
- }
- if (len < 8)
- break;
- }
- /* Now color the run from i0 to ix. */
- code = (*tile_proc)
- (dev, tile, i0 - dx_bit + x, iy + y, ix - i0, 1,
- colors[0], colors[1],
- gx_dc_phase(pdcolor).x, gx_dc_phase(pdcolor).y);
- if (code < 0)
- return code;
-#undef row_bit
- }
- }
- }
- return 0;
+ gx_dc_pure_color(pdcolor), depth);
+ } else
+ return pdcolor->type->fill_masked(pdcolor, data, dx, raster, id,
+ x, y, w, h, dev, lop, false);
}
/* Default implementation of strip_tile_rectangle */