Index: src/ports/SkFontHost_win.cpp |
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp |
index 8aefd1431a525f6e4d2a34775f9b0895bee1d6de..f772d8c57e13b28faebe8ed7f4238001a2f7f271 100644 |
--- a/src/ports/SkFontHost_win.cpp |
+++ b/src/ports/SkFontHost_win.cpp |
@@ -584,6 +584,10 @@ static FIXED float2FIXED(float x) { |
return SkFixedToFIXED(SkFloatToFixed(x)); |
} |
+static inline float FIXED2float(FIXED x) { |
+ return SkFixedToFloat(SkFIXEDToFixed(x)); |
+} |
+ |
static BYTE compute_quality(const SkScalerContext::Rec& rec) { |
switch (rec.fMaskFormat) { |
case SkMask::kBW_Format: |
@@ -856,7 +860,7 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) { |
// Bitmap FON cannot underhang, but vector FON may. |
// There appears no means of determining underhang of vector FON. |
glyph->fLeft = SkToS16(0); |
- glyph->fAdvanceX = SkIntToFixed(glyph->fWidth); |
+ glyph->fAdvanceX = glyph->fWidth; |
glyph->fAdvanceY = 0; |
// Vector FON will transform nicely, but bitmap FON do not. |
@@ -876,8 +880,8 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) { |
} |
// Apply matrix to advance. |
- glyph->fAdvanceY = SkFixedMul(-SkFIXEDToFixed(fMat22.eM12), glyph->fAdvanceX); |
- glyph->fAdvanceX = SkFixedMul(SkFIXEDToFixed(fMat22.eM11), glyph->fAdvanceX); |
+ glyph->fAdvanceY = -FIXED2float(fMat22.eM12) * glyph->fAdvanceX; |
+ glyph->fAdvanceX *= FIXED2float(fMat22.eM11); |
return; |
} |
@@ -922,8 +926,9 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) { |
glyph->fTop -= 2; |
glyph->fLeft -= 2; |
} |
- glyph->fAdvanceX = SkIntToFixed(gm.gmCellIncX); |
- glyph->fAdvanceY = SkIntToFixed(gm.gmCellIncY); |
+ // TODO(benjaminwagner): What is the type of gm.gmCellInc[XY]? |
+ glyph->fAdvanceX = (float)((int)gm.gmCellIncX); |
+ glyph->fAdvanceY = (float)((int)gm.gmCellIncY); |
glyph->fRsbDelta = 0; |
glyph->fLsbDelta = 0; |
@@ -933,16 +938,16 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) { |
if (GDI_ERROR != status) { |
SkPoint advance; |
fHiResMatrix.mapXY(SkIntToScalar(gm.gmCellIncX), SkIntToScalar(gm.gmCellIncY), &advance); |
- glyph->fAdvanceX = SkScalarToFixed(advance.fX); |
- glyph->fAdvanceY = SkScalarToFixed(advance.fY); |
+ glyph->fAdvanceX = SkScalarToFloat(advance.fX); |
+ glyph->fAdvanceY = SkScalarToFloat(advance.fY); |
} |
} else if (!isAxisAligned(this->fRec)) { |
status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, nullptr, &fGsA); |
if (GDI_ERROR != status) { |
SkPoint advance; |
fG_inv.mapXY(SkIntToScalar(gm.gmCellIncX), SkIntToScalar(gm.gmCellIncY), &advance); |
- glyph->fAdvanceX = SkScalarToFixed(advance.fX); |
- glyph->fAdvanceY = SkScalarToFixed(advance.fY); |
+ glyph->fAdvanceX = SkScalarToFloat(advance.fX); |
+ glyph->fAdvanceY = SkScalarToFloat(advance.fY); |
} |
} |
} |