[cairo-commit] Branch '1.8' - src/cairo-win32-font.c
Jeff Muizelaar
jrmuizel at kemper.freedesktop.org
Thu Dec 18 14:08:28 PST 2008
src/cairo-win32-font.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit f60da9a379890a3a4cd74cdad48e73c22cb74160
Author: Jeff Muizelaar <jmuizelaar at mozilla.com>
Date: Thu Dec 18 17:07:25 2008 -0500
Fix _compute_transform to check for nearly degenerate matrices
If a matrix was something like [0 .000001 0, .000001 0 0] the old code would
assume that xx and yy were greater than 0 and turn the nearly degenerate matrix
into an actual degenerate one. This caused things to blow up later on. Now we
check that our nearly rectangular matrices are not nearly degenerate, and let
the nearly degenerate ones fall through to the non-rectangular path.
Note: I'm not sure why NEARLY_ZERO(d) is fabs(d) < 1/65536 instead of some
other value. Hopefully, it's a useful definition.
This problem was found by a test case attached to:
https://bugzilla.mozilla.org/show_bug.cgi?id=467423
diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index 879cfac..b4f125e 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -158,7 +158,8 @@ _compute_transform (cairo_win32_scaled_font_t *scaled_font,
{
cairo_status_t status;
- if (NEARLY_ZERO (sc->yx) && NEARLY_ZERO (sc->xy)) {
+ if (NEARLY_ZERO (sc->yx) && NEARLY_ZERO (sc->xy) &&
+ !NEARLY_ZERO(sc->xx) && !NEARLY_ZERO(sc->yy)) {
scaled_font->preserve_axes = TRUE;
scaled_font->x_scale = sc->xx;
scaled_font->swap_x = (sc->xx < 0);
@@ -166,7 +167,8 @@ _compute_transform (cairo_win32_scaled_font_t *scaled_font,
scaled_font->swap_y = (sc->yy < 0);
scaled_font->swap_axes = FALSE;
- } else if (NEARLY_ZERO (sc->xx) && NEARLY_ZERO (sc->yy)) {
+ } else if (NEARLY_ZERO (sc->xx) && NEARLY_ZERO (sc->yy) &&
+ !NEARLY_ZERO(sc->yx) && !NEARLY_ZERO(sc->xy)) {
scaled_font->preserve_axes = TRUE;
scaled_font->x_scale = sc->yx;
scaled_font->swap_x = (sc->yx < 0);
More information about the cairo-commit
mailing list