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.)
This commit is contained in:
Carl Worth 2006-06-10 10:42:32 -07:00
parent 0662928e4f
commit d758d5104a

View file

@ -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) {