Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: src/core/SkPaint.cpp

Issue 617353003: fix prev change to tooBigForLCD, and add test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/lcdtext.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPaint.cpp
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 7a23566fece108155231987aeaab4392a85ccb28..67b630e850ed288d058977866fa13356fffbe6cc 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1481,14 +1481,15 @@ static SkColor computeLuminanceColor(const SkPaint& paint) {
const SkScalar gMaxSize2ForLCDText = SK_MAX_SIZE_FOR_LCDTEXT * SK_MAX_SIZE_FOR_LCDTEXT;
-static bool tooBigForLCD(const SkScalerContext::Rec& rec, bool checkPost2x2) {
- SkScalar size = rec.fTextSize;
+static bool too_big_for_lcd(const SkScalerContext::Rec& rec, bool checkPost2x2) {
if (checkPost2x2) {
SkScalar area = rec.fPost2x2[0][0] * rec.fPost2x2[1][1] -
rec.fPost2x2[1][0] * rec.fPost2x2[0][1];
- size *= SkScalarAbs(area);
+ area *= rec.fTextSize * rec.fTextSize;
+ return area > gMaxSize2ForLCDText;
+ } else {
+ return rec.fTextSize > SK_MAX_SIZE_FOR_LCDTEXT;
}
- return size > gMaxSize2ForLCDText;
}
/*
@@ -1584,7 +1585,7 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
rec->fMaskFormat = SkToU8(computeMaskFormat(paint));
if (SkMask::kLCD16_Format == rec->fMaskFormat || SkMask::kLCD32_Format == rec->fMaskFormat) {
- if (tooBigForLCD(*rec, checkPost2x2)) {
+ if (too_big_for_lcd(*rec, checkPost2x2)) {
rec->fMaskFormat = SkMask::kA8_Format;
flags |= SkScalerContext::kGenA8FromLCD_Flag;
} else {
« no previous file with comments | « gm/lcdtext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698