summaryrefslogtreecommitdiff
path: root/src/cairo-surface.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-06-10 10:42:32 -0700
committerCarl Worth <cworth@cworth.org>2006-06-10 10:42:32 -0700
commitd758d5104a09019b65c1b2e93fd5ab80b0e4d056 (patch)
tree9fce508a6a001cf1e6a7b9dda3d38136c4b1a01e /src/cairo-surface.c
parent0662928e4fd7bd432fdd815b95271d5c74eaba70 (diff)
Don't create a new scaled_font if there's a device_offset but no device_scale.
(This is covering up my mistake from the last batch of 12 commits which wasn't ready to be pushed yet. This fixes some of the crashes which were introduced, and is a good thing to do regardless.)
Diffstat (limited to 'src/cairo-surface.c')
-rw-r--r--src/cairo-surface.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 17c29535e..0b245f887 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1692,20 +1692,11 @@ _cairo_surface_show_glyphs (cairo_surface_t *surface,
if (_cairo_surface_has_device_transform (surface))
{
int i;
- cairo_font_options_t *font_options;
- cairo_matrix_t font_matrix, dev_ctm;
dev_glyphs = malloc (sizeof(cairo_glyph_t) * num_glyphs);
if (!dev_glyphs)
return CAIRO_STATUS_NO_MEMORY;
- font_options = cairo_font_options_create ();
- status = cairo_font_options_status(font_options);
- if (status) {
- free (dev_glyphs);
- return status;
- }
-
for (i = 0; i < num_glyphs; i++) {
dev_glyphs[i].index = glyphs[i].index;
dev_glyphs[i].x = glyphs[i].x;
@@ -1715,15 +1706,22 @@ _cairo_surface_show_glyphs (cairo_surface_t *surface,
&dev_glyphs[i].y);
}
- cairo_scaled_font_get_font_matrix (scaled_font, &font_matrix),
- cairo_scaled_font_get_ctm (scaled_font, &dev_ctm);
- cairo_matrix_multiply (&dev_ctm, &dev_ctm, &surface->device_transform);
- cairo_scaled_font_get_font_options (scaled_font, font_options);
- dev_scaled_font = cairo_scaled_font_create (cairo_scaled_font_get_font_face (scaled_font),
- &font_matrix,
- &dev_ctm,
- font_options);
- cairo_font_options_destroy (font_options);
+ if (! _cairo_matrix_is_integer_translation (&surface->device_transform, NULL, NULL)) {
+ cairo_font_options_t *font_options;
+ cairo_matrix_t font_matrix, dev_ctm;
+
+ font_options = cairo_font_options_create ();
+
+ cairo_scaled_font_get_font_matrix (scaled_font, &font_matrix);
+ cairo_scaled_font_get_ctm (scaled_font, &dev_ctm);
+ cairo_matrix_multiply (&dev_ctm, &dev_ctm, &surface->device_transform);
+ cairo_scaled_font_get_font_options (scaled_font, font_options);
+ dev_scaled_font = cairo_scaled_font_create (cairo_scaled_font_get_font_face (scaled_font),
+ &font_matrix,
+ &dev_ctm,
+ font_options);
+ cairo_font_options_destroy (font_options);
+ }
}
if (surface->backend->show_glyphs) {