From c27b74174e6a734db3cf1b5a5354eab8f3d27c1c Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Tue, 13 Sep 2011 17:20:30 +0000 Subject: [PATCH] add override for max-text-size for lcd git-svn-id: http://skia.googlecode.com/svn/trunk@2258 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/config/SkUserConfig.h | 7 +++++++ src/core/SkPaint.cpp | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/config/SkUserConfig.h b/include/config/SkUserConfig.h index 05d92acdaf..0064193808 100644 --- a/include/config/SkUserConfig.h +++ b/include/config/SkUserConfig.h @@ -137,6 +137,13 @@ */ //#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. diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 0b8ec22f82..770569a25e 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -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); } /*