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
This commit is contained in:
agl@chromium.org 2010-01-21 11:43:44 +00:00
parent d7a0083aaa
commit b4234a2266
2 changed files with 8 additions and 7 deletions

View 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

View 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