diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 3543f7497c..e3d8dd19af 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -1104,8 +1104,15 @@ static void add_flattenable(SkDescriptor* desc, uint32_t tag, 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) { -#if 0 return !paint.getShader() && !paint.getXfermode() && // unless its srcover !paint.getMaskFilter() && @@ -1114,23 +1121,14 @@ static bool canSupportLCD16(const SkPaint& paint) { !paint.getPathEffect() && !paint.isFakeBoldText() && paint.getStyle() == SkPaint::kFill_Style; -#else - // disable for now, while we test more - return false; -#endif } static SkMask::Format computeMaskFormat(const SkPaint& paint) { uint32_t flags = paint.getFlags(); // Antialiasing being disabled trumps all other settings. - if (!(flags & SkPaint::kAntiAlias_Flag)) + if (!(flags & SkPaint::kAntiAlias_Flag)) { return SkMask::kBW_Format; - - if (flags & SkPaint::kLCDRenderText_Flag) { - if (canSupportLCD16(paint)) { - return SkMask::kLCD16_Format; - } } #if defined(SK_SUPPORT_LCDTEXT) @@ -1138,6 +1136,12 @@ static SkMask::Format computeMaskFormat(const SkPaint& paint) { return SkFontHost::GetSubpixelOrientation() == SkFontHost::kHorizontal_LCDOrientation ? SkMask::kHorizontalLCD_Format : SkMask::kVerticalLCD_Format; } +#else + if (flags & SkPaint::kLCDRenderText_Flag) { + if (canSupportLCD16(paint)) { + return SkMask::kLCD16_Format; + } + } #endif return SkMask::kA8_Format;