From 45a081f14295abf60730f2744cdeea6f0f70c39f Mon Sep 17 00:00:00 2001 From: Byeongsik Jeon Date: Wed, 24 Dec 2008 11:16:04 +0900 Subject: [PATCH] gdi32: Don't truncate the added pixels with FT_LCD_FILTER_DEFAULT. --- dlls/gdi32/freetype.c | 61 +++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 9eb1d13c9ad..d011c97c025 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -4578,9 +4578,7 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format, wine_dbgstr_point(&lpgm->gmptGlyphOrigin), lpgm->gmCellIncX, lpgm->gmCellIncY); - if ((format == GGO_METRICS || format == GGO_BITMAP || format == WINE_GGO_GRAY16_BITMAP || - format == WINE_GGO_HRGB_BITMAP || format == WINE_GGO_HBGR_BITMAP || - format == WINE_GGO_VRGB_BITMAP || format == WINE_GGO_VBGR_BITMAP ) && + if ((format == GGO_METRICS || format == GGO_BITMAP || format == WINE_GGO_GRAY16_BITMAP) && (!lpmat || is_identity_MAT2(lpmat))) /* don't cache custom transforms */ { FONT_GM(font,original_index)->gm = *lpgm; @@ -4741,22 +4739,24 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format, case WINE_GGO_VBGR_BITMAP: #ifdef HAVE_FREETYPE_FTLCDFIL_H { - width = lpgm->gmBlackBoxX; - height = lpgm->gmBlackBoxY; - pitch = width * 4; - needed = pitch * height; - - if (!buf || !buflen) break; - - memset(buf, 0, buflen); - switch (ft_face->glyph->format) { case FT_GLYPH_FORMAT_BITMAP: { - BYTE *src = ft_face->glyph->bitmap.buffer, *dst = buf; - INT src_pitch = ft_face->glyph->bitmap.pitch; - INT x; + BYTE *src, *dst; + INT src_pitch, x; + + width = lpgm->gmBlackBoxX; + height = lpgm->gmBlackBoxY; + pitch = width * 4; + needed = pitch * height; + + if (!buf || !buflen) break; + + memset(buf, 0, buflen); + dst = buf; + src = ft_face->glyph->bitmap.buffer; + src_pitch = ft_face->glyph->bitmap.pitch; while ( height-- ) { @@ -4774,15 +4774,40 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format, case FT_GLYPH_FORMAT_OUTLINE: { - unsigned int *dst = (unsigned int *) buf; + unsigned int *dst; BYTE *src; INT x, src_pitch, rgb_interval, hmul, vmul; - BOOL rgb = (format == WINE_GGO_HRGB_BITMAP || format == WINE_GGO_VRGB_BITMAP); + BOOL rgb; FT_LcdFilter lcdfilter = FT_LCD_FILTER_DEFAULT; FT_Render_Mode render_mode = (format == WINE_GGO_HRGB_BITMAP || format == WINE_GGO_HBGR_BITMAP)? FT_RENDER_MODE_LCD: FT_RENDER_MODE_LCD_V; + if ( lcdfilter == FT_LCD_FILTER_DEFAULT || lcdfilter == FT_LCD_FILTER_LIGHT ) + { + if ( render_mode == FT_RENDER_MODE_LCD) + { + lpgm->gmBlackBoxX += 2; + lpgm->gmptGlyphOrigin.x -= 1; + } + else + { + lpgm->gmBlackBoxY += 2; + lpgm->gmptGlyphOrigin.y += 1; + } + } + + width = lpgm->gmBlackBoxX; + height = lpgm->gmBlackBoxY; + pitch = width * 4; + needed = pitch * height; + + if (!buf || !buflen) break; + + memset(buf, 0, buflen); + dst = (unsigned int *)buf; + rgb = (format == WINE_GGO_HRGB_BITMAP || format == WINE_GGO_VRGB_BITMAP); + if ( needsTransform ) pFT_Outline_Transform (&ft_face->glyph->outline, &transMat); pFT_Outline_Translate (&ft_face->glyph->outline, -left, -bottom ); @@ -4805,8 +4830,6 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format, vmul = 3; } - if ( lcdfilter == FT_LCD_FILTER_DEFAULT || lcdfilter == FT_LCD_FILTER_LIGHT ) - src += rgb_interval * 3; while ( height-- ) { for ( x = 0; x < width; x++ )