From 189cf8b6dbd8b60faef5b0925cba2aba8e77ec27 Mon Sep 17 00:00:00 2001 From: Mason Chang Date: Wed, 1 Feb 2017 15:47:33 -0800 Subject: [PATCH] Bug 1322897. Use only the G channel for grayscale AA Dwrite fonts and Skia. r=lsalzman --- gfx/skia/skia/src/ports/SkScalerContext_win_dw.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gfx/skia/skia/src/ports/SkScalerContext_win_dw.cpp b/gfx/skia/skia/src/ports/SkScalerContext_win_dw.cpp index 2500b0ffffd6..d050cb06966b 100644 --- a/gfx/skia/skia/src/ports/SkScalerContext_win_dw.cpp +++ b/gfx/skia/skia/src/ports/SkScalerContext_win_dw.cpp @@ -682,10 +682,13 @@ static void rgb_to_a8(const uint8_t* SK_RESTRICT src, const SkGlyph& glyph, cons for (U16CPU y = 0; y < glyph.fHeight; y++) { for (U16CPU i = 0; i < width; i++) { - U8CPU r = *(src++); - U8CPU g = *(src++); - U8CPU b = *(src++); - dst[i] = sk_apply_lut_if((r + g + b) / 3, table8); + U8CPU g = src[1]; + src += 3; + + // Ignore the R, B channels. It looks the closest to what + // D2D with grayscale AA has. But there's no way + // to just get a grayscale AA alpha texture from a glyph run. + dst[i] = sk_apply_lut_if(g, table8); } dst = (uint8_t*)((char*)dst + dstRB); }