add override for max-text-size for lcd
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 13 Sep 2011 17:20:30 +0000 (17:20 +0000)
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 13 Sep 2011 17:20:30 +0000 (17:20 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@2258 2bbb7eff-a529-9590-31e7-b0007b416f81

include/config/SkUserConfig.h
src/core/SkPaint.cpp

index 05d92ac..0064193 100644 (file)
  */
 //#define SK_ALLOW_OVER_32K_BITMAPS
 
+/*  Define this to set the upper limit for text to support LCD. Values that
+    are very large increase the cost in the font cache and draw slower, without
+    improving readability. If this is undefined, Skia will use its default
+    value (e.g. 48)
+ */
+//#define SK_MAX_SIZE_FOR_LCDTEXT     48
+
 /*  If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST
     which will run additional self-tests at startup. These can take a long time,
     so this flag is optional.
index 0b8ec22..770569a 100644 (file)
@@ -1226,13 +1226,15 @@ static SkPaint::Hinting computeHinting(const SkPaint& paint) {
 
 // Beyond this size, LCD doesn't appreciably improve quality, but it always
 // cost more RAM and draws slower, so we set a cap.
-static const SkScalar SK_MAX_SIZE_FOR_LCDTEXT = SkIntToScalar(48);
+#ifndef SK_MAX_SIZE_FOR_LCDTEXT
+    #define SK_MAX_SIZE_FOR_LCDTEXT    48
+#endif
 
 static bool tooBigForLCD(const SkScalerContext::Rec& rec) {
     SkScalar area = SkScalarMul(rec.fPost2x2[0][0], rec.fPost2x2[1][1]) -
                     SkScalarMul(rec.fPost2x2[1][0], rec.fPost2x2[0][1]);
     SkScalar size = SkScalarMul(area, rec.fTextSize);
-    return SkScalarAbs(size) > SK_MAX_SIZE_FOR_LCDTEXT;
+    return SkScalarAbs(size) > SkIntToScalar(SK_MAX_SIZE_FOR_LCDTEXT);
 }
 
 /*