[cairo-commit] cairo/src cairo-pattern.c,1.59,1.60
Billy Biggs
commit at pdx.freedesktop.org
Mon Aug 22 07:10:42 EST 2005
Committed by: vektor
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv24562/src
Modified Files:
cairo-pattern.c
Log Message:
Fix for bug #4172:
* src/cairo-pattern.c: (_cairo_pattern_shader_gaussian),
(_cairo_image_data_set_linear), (_cairo_image_data_set_radial):
Use _cairo_fixed_to_double and _cairo_double_to_fixed when converting
between double and 16.16 fixed point. These functions round nicely,
and solve some inconsistencies in rendering between my PPC and x86
machines. Thanks to Owen Taylor for suggesting the fix.
* test/gradient-alpha-ref.png:
* test/linear-gradient-ref.png:
* test/text-pattern-ref.png: The above change does affect linear
gradients slightly, but it seems worth it. Update the reference
images to follow.
Index: cairo-pattern.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pattern.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- cairo-pattern.c 19 Aug 2005 19:08:42 -0000 1.59
+++ cairo-pattern.c 21 Aug 2005 21:10:39 -0000 1.60
@@ -840,9 +840,9 @@
cairo_fixed_t factor,
uint32_t *pixel)
{
- double f = ((double) factor) / 65536.0;
+ double f = _cairo_fixed_to_double (factor);
- factor = (cairo_fixed_t) (((exp (f * f) - 1.0) / E_MINUS_ONE) * 65536);
+ factor = _cairo_fixed_from_double ((exp (f * f) - 1.0) / E_MINUS_ONE);
*pixel = ((INTERPOLATE_COLOR_LINEAR (color0[3], color1[3], factor) << 24) |
(INTERPOLATE_COLOR_LINEAR (color0[0], color1[0], factor) << 16) |
@@ -1068,7 +1068,7 @@
factor = ((dx * qx + dy * qy) - start) * scale;
- _cairo_pattern_calc_color_at_pixel (&op, factor * 65536, pixels++);
+ _cairo_pattern_calc_color_at_pixel (&op, _cairo_fixed_from_double (factor), pixels++);
}
}
@@ -1251,7 +1251,7 @@
}
}
- _cairo_pattern_calc_color_at_pixel (&op, factor * 65536, pixels++);
+ _cairo_pattern_calc_color_at_pixel (&op, _cairo_fixed_from_double (factor), pixels++);
}
}
More information about the cairo-commit
mailing list