[gs-bugs] [Bug 690620] low resolution fill adjust is wrong

bugs.ghostscript.com-bugzilla-daemon at ghostscript.com bugs.ghostscript.com-bugzilla-daemon at ghostscript.com
Wed Jul 15 08:27:38 PDT 2009


http://bugs.ghostscript.com/show_bug.cgi?id=690620





------- Additional Comments From henry.stiles at artifex.com  2009-07-15 08:27 -------
The following code change prints the comprehensive test (see the attachment in
comment #5) reasonably and the regression fixing several problems in the ps
cets.  It also is a reasonable interpretation of the mathematical description of
the filling algorithm from the postscript and pdf manual (6.5.3 scan conversion
rules), contrasting markedly with the code it replaces.  I am posting the patch
here for feedback and counterexamples.

At 72 dpi the patch does give a pixel for pixel match of the rectangles in the
comprehensive test (the current code has many discrepancies), with a few
exceptional cases where the adobe renderer appears incorrect.

NOTE: the code should not be checked in yet since it has not been tested with
languages other than postscript and pdf.

svn diff
Index: gsdps1.c
===================================================================
--- gsdps1.c	(revision 9859)
+++ gsdps1.c	(working copy)
@@ -243,19 +243,21 @@
 		}
 	    } else {
 		int x, y, w, h;
-
-		draw_rect.p.x -= max(pgs->fill_adjust.x - fixed_epsilon, 0);
-		draw_rect.p.y -= max(pgs->fill_adjust.y - fixed_epsilon, 0);
-		draw_rect.q.x += pgs->fill_adjust.x;
-		draw_rect.q.y += pgs->fill_adjust.y;
 		rect_intersect(draw_rect, clip_rect);
-		x = fixed2int_pixround(draw_rect.p.x);
-		y = fixed2int_pixround(draw_rect.p.y);
-		w = fixed2int_pixround(draw_rect.q.x) - x;
-		h = fixed2int_pixround(draw_rect.q.y) - y;
-		if (w > 0 && h > 0)
-    		    if (gx_fill_rectangle(x, y, w, h, pdc, pgs) < 0)
-			goto slow;
+		draw_rect.p.x = fixed_floor(draw_rect.p.x);
+		draw_rect.p.y = fixed_floor(draw_rect.p.y);
+                draw_rect.q.x = fixed_ceiling(draw_rect.q.x);
+                draw_rect.q.y = fixed_ceiling(draw_rect.q.y);
+		x = fixed2int(draw_rect.p.x);
+		y = fixed2int(draw_rect.p.y);
+		w = fixed2int(draw_rect.q.x - draw_rect.p.x);
+		h = fixed2int(draw_rect.q.y - draw_rect.p.y);
+                if (w == 0)
+                    w = 1;
+                if (h == 0)
+                    h = 1;
+                if (gx_fill_rectangle(x, y, w, h, pdc, pgs) < 0)
+                    goto slow;
 	    }
 	}
 	return 0;




------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.



More information about the gs-bugs mailing list