From 7e255d4d385ff815bb2b6680cf98a25e26e9cd90 Mon Sep 17 00:00:00 2001 From: "pavlov%pavlov.net" Date: Fri, 10 Mar 2006 23:42:35 +0000 Subject: [PATCH] fix double glyph drawing with svg. bug 330095. r=vlad --- gfx/cairo/cairo/src/cairo-win32-surface.c | 24 ++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/gfx/cairo/cairo/src/cairo-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c index 2597f3cfc17..7ebe92a312d 100644 --- a/gfx/cairo/cairo/src/cairo-win32-surface.c +++ b/gfx/cairo/cairo/src/cairo-win32-surface.c @@ -1017,12 +1017,11 @@ _cairo_win32_surface_show_glyphs (void *surface, WORD *glyph_buf = glyph_buf_stack; int dx_buf_stack[STACK_GLYPH_SIZE]; int *dx_buf = dx_buf_stack; - const COLORREF color = RGB(((int)solid_pattern->color.red_short) >> 8, - ((int)solid_pattern->color.green_short) >> 8, - ((int)solid_pattern->color.blue_short) >> 8); BOOL result = 0; - int i, last_y_offset = 0; + int i; double last_y = glyphs[0].y; + COLORREF color; + int output_count = 0; if ((op != CAIRO_OPERATOR_SOURCE && op != CAIRO_OPERATOR_OVER) || (dst->format != CAIRO_FORMAT_RGB24) || @@ -1032,6 +1031,10 @@ _cairo_win32_surface_show_glyphs (void *surface, dst->base.clip->surface != NULL))) return CAIRO_INT_STATUS_UNSUPPORTED; + color = RGB(((int)solid_pattern->color.red_short) >> 8, + ((int)solid_pattern->color.green_short) >> 8, + ((int)solid_pattern->color.blue_short) >> 8); + SaveDC(dst->dc); cairo_win32_scaled_font_select_font(scaled_font, dst->dc); @@ -1045,6 +1048,8 @@ _cairo_win32_surface_show_glyphs (void *surface, } for (i = 0; i < num_glyphs; ++i) { + output_count++; + glyph_buf[i] = glyphs[i].index; if (i == num_glyphs - 1) dx_buf[i] = 0; @@ -1053,20 +1058,21 @@ _cairo_win32_surface_show_glyphs (void *surface, if (i == num_glyphs - 1 || glyphs[i].y != glyphs[i+1].y) { + const int offset = (i - output_count) + 1; result = ExtTextOutW(dst->dc, - glyphs[last_y_offset].x * WIN32_FONT_LOGICAL_SCALE, + glyphs[offset].x * WIN32_FONT_LOGICAL_SCALE, last_y * WIN32_FONT_LOGICAL_SCALE, ETO_GLYPH_INDEX, NULL, - glyph_buf + last_y_offset, - (i - last_y_offset) + 1, - dx_buf + last_y_offset); + glyph_buf + offset, + output_count, + dx_buf + offset); if (!result) { _cairo_win32_print_gdi_error("_cairo_win32_surface_show_glyphs(ExtTextOutW failed)"); goto FAIL; } - last_y_offset = i; + output_count = 0; } last_y = glyphs[i].y;