diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2008-01-25 04:16:44 -0500 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2008-01-25 04:16:44 -0500 |
commit | 4c432b09557f52fa35be981743272b33baca6232 (patch) | |
tree | 97183915d9520070b538fa2988b076c447bdf690 /src | |
parent | 8983208f456c6f570698df46174faa0208d6de5f (diff) |
[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.
Diffstat (limited to 'src')
-rw-r--r-- | src/cairo-scaled-font.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c index 47d2047a..e21cd61c 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; |