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. |