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

Unified Diff: src/ports/SkFontHost_mac.cpp

Issue 1737693006: Change type of SkGlyph::fAdvance[XY] to float. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Should be float, not SkScalar. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ports/SkFontHost_FreeType.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_mac.cpp
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 69f660c8f1554c1626d0780e28a98888248a619c..64864507ac5c18a42a791da79ed04658bf863f4b 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -276,13 +276,22 @@ static CGFloat ScalarToCG(SkScalar scalar) {
static SkScalar CGToScalar(CGFloat cgFloat) {
if (sizeof(CGFloat) == sizeof(float)) {
- return cgFloat;
+ return SkFloatToScalar(cgFloat);
} else {
SkASSERT(sizeof(CGFloat) == sizeof(double));
return SkDoubleToScalar(cgFloat);
}
}
+static float CGToFloat(CGFloat cgFloat) {
+ if (sizeof(CGFloat) == sizeof(float)) {
+ return cgFloat;
+ } else {
+ SkASSERT(sizeof(CGFloat) == sizeof(double));
+ return static_cast<float>(cgFloat);
+ }
+}
+
static CGAffineTransform MatrixToCGAffineTransform(const SkMatrix& matrix,
SkScalar sx = SK_Scalar1,
SkScalar sy = SK_Scalar1) {
@@ -1042,8 +1051,8 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
&cgGlyph, &cgAdvance, 1);
}
cgAdvance = CGSizeApplyAffineTransform(cgAdvance, fTransform);
- glyph->fAdvanceX = SkFloatToFixed_Check(cgAdvance.width);
- glyph->fAdvanceY = -SkFloatToFixed_Check(cgAdvance.height);
+ glyph->fAdvanceX = CGToFloat(cgAdvance.width);
+ glyph->fAdvanceY = -CGToFloat(cgAdvance.height);
// The following produces skBounds in SkGlyph units (pixels, y down),
// or returns early if skBounds would be empty.
« no previous file with comments | « src/ports/SkFontHost_FreeType.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698