From 65dd8f83106ceb11fbff330bed3037557db974cf Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Mon, 14 Mar 2011 13:31:16 +0000 Subject: 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 --- src/core/SkPaint.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) 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; -- cgit v1.2.3