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

Side by Side 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 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 "SkAdvancedTypefaceMetrics.h" 9 #include "SkAdvancedTypefaceMetrics.h"
10 #include "SkBase64.h" 10 #include "SkBase64.h"
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 G.setAll(c, -s, 0, 658 G.setAll(c, -s, 0,
659 s, c, 0, 659 s, c, 0,
660 0, 0, SkScalarToPersp(SK_Scalar1)); 660 0, 0, SkScalarToPersp(SK_Scalar1));
661 661
662 // GA is the matrix A with rotation removed. 662 // GA is the matrix A with rotation removed.
663 SkMatrix GA(G); 663 SkMatrix GA(G);
664 GA.preConcat(A); 664 GA.preConcat(A);
665 665
666 // textSize is the actual device size we want (as opposed to the size the us er requested). 666 // textSize is the actual device size we want (as opposed to the size the us er requested).
667 // If the scale is negative, this means the matrix will do the flip anyway. 667 // If the scale is negative, this means the matrix will do the flip anyway.
668 SkScalar textSize = SkScalarAbs(SkScalarRoundToScalar(GA.get(SkMatrix::kMSca leY))); 668 SkScalar realTextSize = SkScalarAbs(GA.get(SkMatrix::kMScaleY));
669 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
669 if (textSize == 0) { 670 if (textSize == 0) {
670 textSize = SK_Scalar1; 671 textSize = SK_Scalar1;
671 } 672 }
672 673
674 // When not hinting, remove only the textSize scale which will be applied by GDI.
675 // When GDI hinting, remove the entire Y scale to prevent 'subpixel' metrics .
676 SkScalar scale = (fRec.getHinting() == SkPaint::kNo_Hinting ||
677 fRec.getHinting() == SkPaint::kSlight_Hinting)
678 ? SkScalarInvert(textSize)
679 : SkScalarInvert(realTextSize);
680
673 // sA is the total matrix A without the textSize (so GDI knows the text size separately). 681 // sA is the total matrix A without the textSize (so GDI knows the text size separately).
674 // When this matrix is used with GetGlyphOutline, no further processing is n eeded. 682 // When this matrix is used with GetGlyphOutline, no further processing is n eeded.
675 SkMatrix sA(A); 683 SkMatrix sA(A);
676 SkScalar scale = SkScalarInvert(textSize);
677 sA.preScale(scale, scale); //remove text size 684 sA.preScale(scale, scale); //remove text size
678 685
679 // GsA is the non-rotational part of A without the text height scale. 686 // GsA is the non-rotational part of A without the text height scale.
680 // This is what is used to find the magnitude of advances. 687 // This is what is used to find the magnitude of advances.
681 SkMatrix GsA(GA); 688 SkMatrix GsA(GA);
682 GsA.preScale(scale, scale); //remove text size, G is rotational so reorders with the scale. 689 GsA.preScale(scale, scale); //remove text size, G is rotational so reorders with the scale.
683 690
684 fGsA.eM11 = SkScalarToFIXED(GsA.get(SkMatrix::kMScaleX)); 691 fGsA.eM11 = SkScalarToFIXED(GsA.get(SkMatrix::kMScaleX));
685 fGsA.eM12 = SkScalarToFIXED(-GsA.get(SkMatrix::kMSkewY)); // This should be ~0. 692 fGsA.eM12 = SkScalarToFIXED(-GsA.get(SkMatrix::kMSkewY)); // This should be ~0.
686 fGsA.eM21 = SkScalarToFIXED(-GsA.get(SkMatrix::kMSkewX)); 693 fGsA.eM21 = SkScalarToFIXED(-GsA.get(SkMatrix::kMSkewX));
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after
2407 2414
2408 SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) { 2415 SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
2409 return create_from_stream(stream); 2416 return create_from_stream(stream);
2410 } 2417 }
2411 2418
2412 #endif 2419 #endif
2413 2420
2414 SkFontMgr* SkFontMgr_New_GDI() { 2421 SkFontMgr* SkFontMgr_New_GDI() {
2415 return SkNEW(SkFontMgrGDI); 2422 return SkNEW(SkFontMgrGDI);
2416 } 2423 }
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