[gs-cvs] rev 8733 - trunk/gs/src
marcos at ghostscript.com
marcos at ghostscript.com
Wed May 14 17:00:25 PDT 2008
Author: marcos
Date: 2008-05-14 17:00:24 -0700 (Wed, 14 May 2008)
New Revision: 8733
Modified:
trunk/gs/src/gdevpx.c
Log:
Improve white-on-mask drawing mode.
Details:
This patch is provided by Hin-Tak (see bug 688372); his comments:
This is a patch which I have created, to make the pxlmono/pxlcolor driver
bebaves much better in the white-on-mask situation, without breaking
normal drawing.
I haven't quite work out all the details nor understand the
reverse-mask-draw code properly yet, but this patch improves the situation
a great deal, to the point all the icons are shown correctly except for
having its background draw solid white rather than transparent
Modified: trunk/gs/src/gdevpx.c
===================================================================
--- trunk/gs/src/gdevpx.c 2008-05-14 23:49:09 UTC (rev 8732)
+++ trunk/gs/src/gdevpx.c 2008-05-15 00:00:24 UTC (rev 8733)
@@ -1241,25 +1241,41 @@
/*
* The following doesn't work if we're writing white with a mask.
* We'll fix it eventually.
+ *
+ * This is a slightly better version than before (see bug 688372).
*/
- if (zero == gx_no_color_index) {
- if (one == gx_no_color_index)
- return 0;
- lop = rop3_S | lop_S_transparent;
- color0 = (1 << dev->color_info.depth) - 1;
- } else if (one == gx_no_color_index) {
- lop = rop3_S | lop_S_transparent;
- color1 = (1 << dev->color_info.depth) - 1;
+ if (zero == one) {
+ if (zero == gx_no_color_index) {
+ /* one != gx_no_color_index */
+ lop = rop3_S | lop_S_transparent;
+ color0 = (1 << dev->color_info.depth) - 1;
+ } else if (one == gx_no_color_index) {
+ /* zero != gx_no_color_index */
+ lop = rop3_S | lop_S_transparent;
+ color1 = (1 << dev->color_info.depth) - 1;
+ } else {
+ /* both != no_color_index */
+ lop = rop3_S;
+ }
} else {
- lop = rop3_S;
+ if_debug3('b', "zero %d one %d noidx %08X\n", zero, one, gx_no_color_index);
+ if ((zero == gx_no_color_index) &&
+ (one == gx_no_color_index))
+ return 0;
+ lop = lop_T_transparent |rop3_S;
+ color1 = one;
+ color0 = one;
}
+
if (dev->color_info.num_components == 1 ||
(RGB_IS_GRAY(color0) && RGB_IS_GRAY(color1))
) {
+ if_debug2('b', "color palette %02X %02X\n", palette[0], palette[1]);
palette[0] = (byte) color0;
palette[1] = (byte) color1;
palette_size = 2;
color_space = eGray;
+ if_debug2('b', "color palette %02X %02X\n", palette[0], palette[1]);
} else {
palette[0] = (byte) (color0 >> 16);
palette[1] = (byte) (color0 >> 8);
More information about the gs-cvs
mailing list