Don't use LCD16 if SK_SUPPORT_LCDTEXT is defined (for compatibility)

git-svn-id: http://skia.googlecode.com/svn/trunk@928 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2011-03-14 13:31:16 +00:00
parent ed8c4d186d
commit 65dd8f8310

View File

@ -1104,8 +1104,15 @@ static void add_flattenable(SkDescriptor* desc, uint32_t tag,
buffer->flatten(desc->addEntry(tag, buffer->size(), NULL)); buffer->flatten(desc->addEntry(tag, buffer->size(), NULL));
} }
/*
* Returns false if any condition holds where we cannot support rendering
* LCD16 text. Over time we may loosen these restrictions (e.g. as we write
* more blits that can handle it).
*
* The goal is to never return false if the user has requested it, but for now
* we have some restrictions.
*/
static bool canSupportLCD16(const SkPaint& paint) { static bool canSupportLCD16(const SkPaint& paint) {
#if 0
return !paint.getShader() && return !paint.getShader() &&
!paint.getXfermode() && // unless its srcover !paint.getXfermode() && // unless its srcover
!paint.getMaskFilter() && !paint.getMaskFilter() &&
@ -1114,23 +1121,14 @@ static bool canSupportLCD16(const SkPaint& paint) {
!paint.getPathEffect() && !paint.getPathEffect() &&
!paint.isFakeBoldText() && !paint.isFakeBoldText() &&
paint.getStyle() == SkPaint::kFill_Style; paint.getStyle() == SkPaint::kFill_Style;
#else
// disable for now, while we test more
return false;
#endif
} }
static SkMask::Format computeMaskFormat(const SkPaint& paint) { static SkMask::Format computeMaskFormat(const SkPaint& paint) {
uint32_t flags = paint.getFlags(); uint32_t flags = paint.getFlags();
// Antialiasing being disabled trumps all other settings. // Antialiasing being disabled trumps all other settings.
if (!(flags & SkPaint::kAntiAlias_Flag)) if (!(flags & SkPaint::kAntiAlias_Flag)) {
return SkMask::kBW_Format; return SkMask::kBW_Format;
if (flags & SkPaint::kLCDRenderText_Flag) {
if (canSupportLCD16(paint)) {
return SkMask::kLCD16_Format;
}
} }
#if defined(SK_SUPPORT_LCDTEXT) #if defined(SK_SUPPORT_LCDTEXT)
@ -1138,6 +1136,12 @@ static SkMask::Format computeMaskFormat(const SkPaint& paint) {
return SkFontHost::GetSubpixelOrientation() == SkFontHost::kHorizontal_LCDOrientation ? return SkFontHost::GetSubpixelOrientation() == SkFontHost::kHorizontal_LCDOrientation ?
SkMask::kHorizontalLCD_Format : SkMask::kVerticalLCD_Format; SkMask::kHorizontalLCD_Format : SkMask::kVerticalLCD_Format;
} }
#else
if (flags & SkPaint::kLCDRenderText_Flag) {
if (canSupportLCD16(paint)) {
return SkMask::kLCD16_Format;
}
}
#endif #endif
return SkMask::kA8_Format; return SkMask::kA8_Format;