aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-14 13:31:16 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-14 13:31:16 +0000
commit65dd8f83106ceb11fbff330bed3037557db974cf (patch)
treec11d003b12dd90304d3cfbf75ea08e8c205d5ffc
parented8c4d186d28466dd5f97c7bf71031873313be00 (diff)
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
-rw-r--r--src/core/SkPaint.cpp26
1 files 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;