skia: Always use aliased text when antialiasing is disabled.
authoragl@chromium.org <agl@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 21 Jan 2010 11:43:44 +0000 (11:43 +0000)
committeragl@chromium.org <agl@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 21 Jan 2010 11:43:44 +0000 (11:43 +0000)
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
src/ports/SkFontHost_FreeType.cpp

index a0fc90d3e5907e5241cfa9e3219f14ea9d04b8cd..c918ff695042a34ec7ffff9f0d6fa7746298f2cd 100644 (file)
@@ -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
index 0974b8da8f3c7553fb8157642d3bb50c8bb4f8ad..ae5f738decb2377cb558cd17fec5f5a88ecc6170 100644 (file)
@@ -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