[cairo] Handling degenerate matrices
Behdad Esfahbod
behdad at behdad.org
Sat Jun 2 22:25:01 PDT 2007
Hi,
It started with http://bugzilla.gnome.org/show_bug.cgi?id=431990
In short, thanks to Chris Wilson's lots of error-path fixes, we now only
go into an error state if a font is rendered at size zero. Of course I
want to make it work with no errors. So far I've got this:
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -367,7 +367,11 @@ _cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
inverse = scaled_font->scale;
status = cairo_matrix_invert (&inverse);
if (status)
- return status;
+ {
+ cairo_matrix_init (&inverse, 0, 0, 0, 0, 0, 0);
+ inverse.x0 = -scaled_font->scale.x0;
+ inverse.y0 = -scaled_font->scale.y0;
+ }
scaled_font->glyphs = _cairo_cache_create (_cairo_scaled_glyph_keys_equal,
_cairo_scaled_glyph_destroy,
But I'm going to start hacking on that long overdue cairo_transform_t
thing. The main problems are:
- What to do when a matrix maps a 2d space to a 1d space?
- How to keep track of the shear matrix when a matrix is transformed
(eg. scaled) to 0? This is needed when using a zero matrix as a pattern
transform. You would need the axes still for CAIRO_EXTEND_PAD.
Just a heads up and to steer discussion.
--
behdad
http://behdad.org/
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759
More information about the cairo
mailing list