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

Side by Side Diff: src/ports/SkFontHost_mac.cpp

Issue 2276583003: SkScalerContextRec::computeMatrices to return status. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « src/core/SkScalerContext.cpp ('k') | 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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkTypes.h" // Keep this before any #ifdef ... 8 #include "SkTypes.h" // Keep this before any #ifdef ...
9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
10 10
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 800
801 CTFontRef ctFont = typeface->fFontRef.get(); 801 CTFontRef ctFont = typeface->fFontRef.get();
802 CFIndex numGlyphs = CTFontGetGlyphCount(ctFont); 802 CFIndex numGlyphs = CTFontGetGlyphCount(ctFont);
803 SkASSERT(numGlyphs >= 1 && numGlyphs <= 0xFFFF); 803 SkASSERT(numGlyphs >= 1 && numGlyphs <= 0xFFFF);
804 fGlyphCount = SkToU16(numGlyphs); 804 fGlyphCount = SkToU16(numGlyphs);
805 805
806 // CT on (at least) 10.9 will size color glyphs down from the requested size , but not up. 806 // CT on (at least) 10.9 will size color glyphs down from the requested size , but not up.
807 // As a result, it is necessary to know the actual device size and request t hat. 807 // As a result, it is necessary to know the actual device size and request t hat.
808 SkVector scale; 808 SkVector scale;
809 SkMatrix skTransform; 809 SkMatrix skTransform;
810 fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatrixScale, &scale, & skTransform, 810 bool invertable = fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatr ixScale,
811 nullptr, nullptr, &fFUnitMatrix); 811 &scale, &skTransform, nullptr, nullpt r, &fFUnitMatrix);
812 fTransform = MatrixToCGAffineTransform(skTransform); 812 fTransform = MatrixToCGAffineTransform(skTransform);
813 fInvTransform = CGAffineTransformInvert(fTransform); 813 // CGAffineTransformInvert documents that if the transform is non-invertible it will return the
814 // passed transform unchanged. It does so, but then also prints a message to stdout. Avoid this.
815 if (invertable) {
816 fInvTransform = CGAffineTransformInvert(fTransform);
817 } else {
818 fInvTransform = fTransform;
819 }
814 820
815 // The transform contains everything except the requested text size. 821 // The transform contains everything except the requested text size.
816 // Some properties, like 'trak', are based on the text size (before applying the matrix). 822 // Some properties, like 'trak', are based on the text size (before applying the matrix).
817 CGFloat textSize = ScalarToCG(scale.y()); 823 CGFloat textSize = ScalarToCG(scale.y());
818 fCTFont.reset(ctfont_create_exact_copy(ctFont, textSize, nullptr)); 824 fCTFont.reset(ctfont_create_exact_copy(ctFont, textSize, nullptr));
819 fCGFont.reset(CTFontCopyGraphicsFont(fCTFont, nullptr)); 825 fCGFont.reset(CTFontCopyGraphicsFont(fCTFont, nullptr));
820 826
821 // The fUnitMatrix includes the text size (and em) as it is used to scale th e raw font data. 827 // The fUnitMatrix includes the text size (and em) as it is used to scale th e raw font data.
822 SkScalar emPerFUnit = SkScalarInvert(SkIntToScalar(CGFontGetUnitsPerEm(fCGFo nt))); 828 SkScalar emPerFUnit = SkScalarInvert(SkIntToScalar(CGFontGetUnitsPerEm(fCGFo nt)));
823 fFUnitMatrix.preScale(emPerFUnit, -emPerFUnit); 829 fFUnitMatrix.preScale(emPerFUnit, -emPerFUnit);
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after
2611 2617
2612 return SkSafeRef(GetDefaultFace()); 2618 return SkSafeRef(GetDefaultFace());
2613 } 2619 }
2614 }; 2620 };
2615 2621
2616 /////////////////////////////////////////////////////////////////////////////// 2622 ///////////////////////////////////////////////////////////////////////////////
2617 2623
2618 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } 2624 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; }
2619 2625
2620 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 2626 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
OLDNEW
« no previous file with comments | « src/core/SkScalerContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698