From b4234a226612cf7f99a47d9c633233c1a488d6ed Mon Sep 17 00:00:00 2001 From: "agl@chromium.org" Date: Thu, 21 Jan 2010 11:43:44 +0000 Subject: [PATCH] skia: Always use aliased text when antialiasing is disabled. Otherwise, people who have antialiasing disabled end up with subpixel rendering if the subpixel setting happens to be set to something other than "none". This change's interpretation of these overlapping settings seems to be consistent with GTK's and Firefox's. Patch-by: Dan Erat Signed-off-by: Adam Langley BUG=http://code.google.com/p/chromium/issues/detail?id=28382 http://codereview.appspot.com/186248 git-svn-id: http://skia.googlecode.com/svn/trunk@475 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkPaint.cpp | 13 +++++++------ src/ports/SkFontHost_FreeType.cpp | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index a0fc90d3e5..c918ff6950 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -1152,16 +1152,17 @@ static SkMask::Format computeMaskFormat(const SkPaint& paint) { uint32_t flags = paint.getFlags(); - if (flags & SkPaint::kLCDRenderText_Flag) + // Antialiasing being disabled trumps all other settings. + if (!(flags & SkPaint::kAntiAlias_Flag)) + return SkMask::kBW_Format; + #if defined(SK_SUPPORT_LCDTEXT) + if (flags & SkPaint::kLCDRenderText_Flag) return SkFontHost::GetSubpixelOrientation() == SkFontHost::kHorizontal_LCDOrientation ? SkMask::kHorizontalLCD_Format : SkMask::kVerticalLCD_Format; -#else - return SkMask::kA8_Format; #endif - if (flags & SkPaint::kAntiAlias_Flag) - return SkMask::kA8_Format; - return SkMask::kBW_Format; + + return SkMask::kA8_Format; } // if linear-text is on, then we force hinting to be off (since that's sort of diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 0974b8da8f..ae5f738dec 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -281,7 +281,7 @@ void SkFontHost::FilterRec(SkScalerContext::Rec* rec) { SkPaint::Hinting h = rec->getHinting(); if (SkPaint::kFull_Hinting == h && !rec->isLCD()) { - // collapse full->normaling hinting if we're not doing LCD + // collapse full->normal hinting if we're not doing LCD h = SkPaint::kNormal_Hinting; } else if (rec->fSubpixelPositioning && SkPaint::kNo_Hinting != h) { // to do subpixel, we must have at most slight hinting