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

Unified Diff: src/ports/SkFontHost_win.cpp

Issue 25739002: Snap GDI matrix when snapping height. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_win.cpp
===================================================================
--- a/src/ports/SkFontHost_win.cpp (revision 11569)
+++ b/src/ports/SkFontHost_win.cpp (working copy)
@@ -665,15 +665,22 @@
// textSize is the actual device size we want (as opposed to the size the user requested).
// If the scale is negative, this means the matrix will do the flip anyway.
- SkScalar textSize = SkScalarAbs(SkScalarRoundToScalar(GA.get(SkMatrix::kMScaleY)));
+ SkScalar realTextSize = SkScalarAbs(GA.get(SkMatrix::kMScaleY));
+ SkScalar textSize = SkScalarRoundToScalar(realTextSize);
reed1 2013/10/03 14:21:07 can we rename this something more distinct from re
bungeman-skia 2013/10/03 15:48:31 I'd hate to have two separate calls to SkScalarInv
if (textSize == 0) {
textSize = SK_Scalar1;
}
+ // When not hinting, remove only the textSize scale which will be applied by GDI.
+ // When GDI hinting, remove the entire Y scale to prevent 'subpixel' metrics.
+ SkScalar scale = (fRec.getHinting() == SkPaint::kNo_Hinting ||
+ fRec.getHinting() == SkPaint::kSlight_Hinting)
+ ? SkScalarInvert(textSize)
+ : SkScalarInvert(realTextSize);
+
// sA is the total matrix A without the textSize (so GDI knows the text size separately).
// When this matrix is used with GetGlyphOutline, no further processing is needed.
SkMatrix sA(A);
- SkScalar scale = SkScalarInvert(textSize);
sA.preScale(scale, scale); //remove text size
// GsA is the non-rotational part of A without the text height scale.
« 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