[cairo-commit] src/cairo-scaled-font.c
Behdad Esfahbod
behdad at kemper.freedesktop.org
Fri Jan 25 01:16:50 PST 2008
src/cairo-scaled-font.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 4c432b09557f52fa35be981743272b33baca6232
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Jan 25 04:16:44 2008 -0500
[cairo-scaled-font] Fix bug in glyphs bounding box computation
In 02970ac8cf27bc9d42cf27848a97019d9dd13b6d Vlad introduced the following
innocent-looking change:
- short min_x = INT16_MAX, max_x = INT16_MIN;
- short min_y = INT16_MAX, max_y = INT16_MIN;
+ cairo_point_int_t min = { CAIRO_RECT_INT_MIN, CAIRO_RECT_INT_MIN };
+ cairo_point_int_t max = { CAIRO_RECT_INT_MAX, CAIRO_RECT_INT_MAX };
Well, read it carefully... yeah. That caused each show glyph operation
upload a mask the size of the surface. With evince/poppler and certain
PDF files that each glyph is rendered in its own cairo_show_glyphs()
call, that meant a 20x slowdown in rendering a page of PDF.
If still wondering what's wrong with that change, here is the answer:
- cairo_point_int_t min = { CAIRO_RECT_INT_MIN, CAIRO_RECT_INT_MIN };
- cairo_point_int_t max = { CAIRO_RECT_INT_MAX, CAIRO_RECT_INT_MAX };
+ cairo_point_int_t min = { CAIRO_RECT_INT_MAX, CAIRO_RECT_INT_MAX };
+ cairo_point_int_t max = { CAIRO_RECT_INT_MIN, CAIRO_RECT_INT_MIN };
Yay for git-bisect.
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 47d2047..e21cd61 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -1142,8 +1142,8 @@ _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font,
{
cairo_status_t status = CAIRO_STATUS_SUCCESS;
int i;
- cairo_point_int_t min = { CAIRO_RECT_INT_MIN, CAIRO_RECT_INT_MIN };
- cairo_point_int_t max = { CAIRO_RECT_INT_MAX, CAIRO_RECT_INT_MAX };
+ cairo_point_int_t min = { CAIRO_RECT_INT_MAX, CAIRO_RECT_INT_MAX };
+ cairo_point_int_t max = { CAIRO_RECT_INT_MIN, CAIRO_RECT_INT_MIN };
if (scaled_font->status)
return scaled_font->status;
More information about the cairo-commit
mailing list