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

Side by Side Diff: src/core/SkPaint.cpp

Issue 200643003: change tooBitForLCD to compare against linear size of the text, not the area (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 1545
1546 #define assert_byte(x) SkASSERT(0 == ((x) >> 8)) 1546 #define assert_byte(x) SkASSERT(0 == ((x) >> 8))
1547 1547
1548 // Beyond this size, LCD doesn't appreciably improve quality, but it always 1548 // Beyond this size, LCD doesn't appreciably improve quality, but it always
1549 // cost more RAM and draws slower, so we set a cap. 1549 // cost more RAM and draws slower, so we set a cap.
1550 #ifndef SK_MAX_SIZE_FOR_LCDTEXT 1550 #ifndef SK_MAX_SIZE_FOR_LCDTEXT
1551 #define SK_MAX_SIZE_FOR_LCDTEXT 48 1551 #define SK_MAX_SIZE_FOR_LCDTEXT 48
1552 #endif 1552 #endif
1553 1553
1554 static bool tooBigForLCD(const SkScalerContext::Rec& rec) { 1554 static bool tooBigForLCD(const SkScalerContext::Rec& rec) {
1555 SkScalar area = SkScalarMul(rec.fPost2x2[0][0], rec.fPost2x2[1][1]) - 1555 SkScalar area = rec.fPost2x2[0][0] * rec.fPost2x2[1][1] -
1556 SkScalarMul(rec.fPost2x2[1][0], rec.fPost2x2[0][1]); 1556 rec.fPost2x2[1][0] * rec.fPost2x2[0][1];
1557 SkScalar size = SkScalarMul(area, rec.fTextSize); 1557 SkScalar size = SkScalarSqrt(SkScalarAbs(area)) * rec.fTextSize;
1558 return SkScalarAbs(size) > SkIntToScalar(SK_MAX_SIZE_FOR_LCDTEXT); 1558 return size > SkIntToScalar(SK_MAX_SIZE_FOR_LCDTEXT);
1559 } 1559 }
1560 1560
1561 /* 1561 /*
1562 * Return the scalar with only limited fractional precision. Used to consolidat e matrices 1562 * Return the scalar with only limited fractional precision. Used to consolidat e matrices
1563 * that vary only slightly when we create our key into the font cache, since th e font scaler 1563 * that vary only slightly when we create our key into the font cache, since th e font scaler
1564 * typically returns the same looking resuts for tiny changes in the matrix. 1564 * typically returns the same looking resuts for tiny changes in the matrix.
1565 */ 1565 */
1566 static SkScalar sk_relax(SkScalar x) { 1566 static SkScalar sk_relax(SkScalar x) {
1567 int n = sk_float_round2int(x * 1024); 1567 int n = sk_float_round2int(x * 1024);
1568 return n / 1024.0f; 1568 return n / 1024.0f;
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
2657 } 2657 }
2658 #ifdef SK_BUILD_FOR_ANDROID 2658 #ifdef SK_BUILD_FOR_ANDROID
2659 if (dirty & kPaintOptionsAndroid_DirtyBit) { 2659 if (dirty & kPaintOptionsAndroid_DirtyBit) {
2660 SkPaintOptionsAndroid options; 2660 SkPaintOptionsAndroid options;
2661 options.unflatten(buffer); 2661 options.unflatten(buffer);
2662 paint->setPaintOptionsAndroid(options); 2662 paint->setPaintOptionsAndroid(options);
2663 } 2663 }
2664 #endif 2664 #endif
2665 SkASSERT(dirty == paint->fDirtyBits); 2665 SkASSERT(dirty == paint->fDirtyBits);
2666 } 2666 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698