diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-12-18 02:34:53 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-12-18 02:34:53 +0000 |
commit | eb12e36e8f06cd04b9f7b7b1de0c110a1e3dcb96 (patch) | |
tree | 331f54d36b8e2b99e82aecf444fe71a034578273 /pango/pangocairo-render.c | |
parent | 5c3e7af5c1718a153288a97729fa4ccaccb93b26 (diff) | |
download | pango-eb12e36e8f06cd04b9f7b7b1de0c110a1e3dcb96.tar.gz |
Avoid some floating-point operations by caching the y value for the
2006-12-17 Behdad Esfahbod <behdad@gnome.org>
* pango/pangocairo-render.c (pango_cairo_renderer_draw_glyphs):
Avoid some floating-point operations by caching the y value for the
baseline, using it for glyphs having y_offset of 0.
Diffstat (limited to 'pango/pangocairo-render.c')
-rw-r--r-- | pango/pangocairo-render.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c index 642b6a5d..48aedf95 100644 --- a/pango/pangocairo-render.c +++ b/pango/pangocairo-render.c @@ -196,6 +196,8 @@ pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer, int x_position = 0; cairo_glyph_t *cairo_glyphs; cairo_glyph_t stack_glyphs[MAX_STACK]; + double base_x = crenderer->x_offset + (double)x / PANGO_SCALE; + double base_y = crenderer->y_offset + (double)y / PANGO_SCALE; cairo_save (crenderer->cr); if (!crenderer->do_path) @@ -209,10 +211,10 @@ pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer, if (gi->glyph != PANGO_GLYPH_EMPTY) { - double cx = crenderer->x_offset + - (double)(x + x_position + gi->geometry.x_offset) / PANGO_SCALE; - double cy = crenderer->y_offset + - (double)(y + gi->geometry.y_offset) / PANGO_SCALE; + double cx = base_x + (double)(x_position + gi->geometry.x_offset) / PANGO_SCALE; + double cy = gi->geometry.y_offset == 0 ? + base_y : + base_y + (double)(gi->geometry.y_offset) / PANGO_SCALE; _pango_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy); } @@ -234,10 +236,10 @@ pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer, if (gi->glyph != PANGO_GLYPH_EMPTY) { - double cx = crenderer->x_offset + - (double)(x + x_position + gi->geometry.x_offset) / PANGO_SCALE; - double cy = crenderer->y_offset + - (double)(y + gi->geometry.y_offset) / PANGO_SCALE; + double cx = base_x + (double)(x_position + gi->geometry.x_offset) / PANGO_SCALE; + double cy = gi->geometry.y_offset == 0 ? + base_y : + base_y + (double)(gi->geometry.y_offset) / PANGO_SCALE; if (gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG) _pango_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy); |