[cairo-bugs] [Bug 5824] New: Rounding error introduced in recent
commit
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Mon Feb 6 07:21:24 PST 2006
Please do not reply to this email: if you want to comment on the bug, go to
the URL shown below and enter yourcomments there.
https://bugs.freedesktop.org/show_bug.cgi?id=5824
Summary: Rounding error introduced in recent commit
Product: cairo
Version: 1.1.1
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: pdf backend
AssignedTo: krh at bitplanet.net
ReportedBy: jlt_fdo at shamrock.dyndns.org
QAContact: cairo-bugs at cairographics.org
I think a recent commit introduced a rounding error in the PDF backend:
Index: cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- cairo-pdf-surface.c 16 Dec 2005 11:02:35 -0000 1.69
+++ cairo-pdf-surface.c 5 Jan 2006 13:06:50 -0000 1.70
@@ -971,11 +971,11 @@
n_stops = pattern->n_stops;
for (i = 0; i < pattern->n_stops; i++) {
- stops[i].color_char[0] = pattern->stops[i].color.red * 0xff + 0.5;
- stops[i].color_char[1] = pattern->stops[i].color.green * 0xff + 0.5;
- stops[i].color_char[2] = pattern->stops[i].color.blue * 0xff + 0.5;
- stops[i].color_char[3] = pattern->stops[i].color.alpha * 0xff + 0.5;
- stops[i].offset = _cairo_fixed_to_double (pattern->stops[i].offset);
+ stops[i].color_char[0] = pattern->stops[i].color.red >> 8;
+ stops[i].color_char[1] = pattern->stops[i].color.green >> 8;
+ stops[i].color_char[2] = pattern->stops[i].color.blue >> 8;
+ stops[i].color_char[3] = pattern->stops[i].color.alpha >> 8;
+ stops[i].offset = _cairo_fixed_to_double (pattern->stops[i].x);
stops[i].id = i;
}
The colour conversion should rather be:
stops[i].color_char[0] = (pattern->stops[i].color.red + 0x80) >> 8;
stops[i].color_char[1] = (pattern->stops[i].color.green + 0x80) >> 8;
stops[i].color_char[2] = (pattern->stops[i].color.blue + 0x80) >> 8;
stops[i].color_char[3] = (pattern->stops[i].color.alpha + 0x80) >> 8;
(Think of a color value such as 0x12ff which should obviously be converted to 0x13)
Jens
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.
More information about the cairo-bugs
mailing list