Change type of SkScalerContext_FreeType::fScaleX/Y. All uses want FT_F26Dot6.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1711053004
Review URL: https://codereview.chromium.org/1711053004
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index ffac0ca..d61a943 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -200,7 +200,7 @@
FT_Face fFace; // reference to shared face in gFaceRecHead
FT_Size fFTSize; // our own copy
FT_Int fStrikeIndex;
- SkFixed fScaleX, fScaleY;
+ FT_F26Dot6 fScaleX, fScaleY;
FT_Matrix fMatrix22;
uint32_t fLoadGlyphFlags;
bool fDoLinearMetrics;
@@ -740,14 +740,14 @@
return true;
}
-static FT_Int chooseBitmapStrike(FT_Face face, SkFixed scaleY) {
+static FT_Int chooseBitmapStrike(FT_Face face, FT_F26Dot6 scaleY) {
// early out if face is bad
if (face == nullptr) {
SkDEBUGF(("chooseBitmapStrike aborted due to nullptr face\n"));
return -1;
}
// determine target ppem
- FT_Pos targetPPEM = SkFixedToFDot6(scaleY);
+ FT_Pos targetPPEM = scaleY;
// find a bitmap strike equal to or just larger than the requested size
FT_Int chosenStrikeIndex = -1;
FT_Pos chosenPPEM = 0;
@@ -805,8 +805,8 @@
fMatrix22Scalar.setSkewX(-fMatrix22Scalar.getSkewX());
fMatrix22Scalar.setSkewY(-fMatrix22Scalar.getSkewY());
- fScaleX = SkScalarToFixed(fScale.fX);
- fScaleY = SkScalarToFixed(fScale.fY);
+ fScaleX = SkScalarToFDot6(fScale.fX);
+ fScaleY = SkScalarToFDot6(fScale.fY);
fMatrix22.xx = SkScalarToFixed(fMatrix22Scalar.getScaleX());
fMatrix22.xy = SkScalarToFixed(fMatrix22Scalar.getSkewX());
fMatrix22.yx = SkScalarToFixed(fMatrix22Scalar.getSkewY());
@@ -898,7 +898,7 @@
}
if (FT_IS_SCALABLE(fFace)) {
- err = FT_Set_Char_Size(fFace, SkFixedToFDot6(fScaleX), SkFixedToFDot6(fScaleY), 72, 72);
+ err = FT_Set_Char_Size(fFace, fScaleX, fScaleY, 72, 72);
if (err != 0) {
SkDEBUGF(("FT_Set_CharSize(%08x, 0x%x, 0x%x) returned 0x%x\n",
fFace, fScaleX, fScaleY, err));
@@ -910,7 +910,7 @@
fStrikeIndex = chooseBitmapStrike(fFace, fScaleY);
if (fStrikeIndex == -1) {
SkDEBUGF(("no glyphs for font \"%s\" size %f?\n",
- fFace->family_name, SkFixedToScalar(fScaleY)));
+ fFace->family_name, SkFDot6ToScalar(fScaleY)));
} else {
// FreeType does no provide linear metrics for bitmap fonts.
linearMetrics = false;
@@ -925,7 +925,7 @@
}
} else {
SkDEBUGF(("unknown kind of font \"%s\" size %f?\n",
- fFace->family_name, SkFixedToScalar(fScaleY)));
+ fFace->family_name, SkFDot6ToScalar(fScaleY)));
}
fDoLinearMetrics = linearMetrics;
@@ -1187,9 +1187,9 @@
// If the font isn't scalable, scale the metrics from the non-scalable strike.
// This means do not try to scale embedded bitmaps; only scale bitmaps in bitmap only fonts.
- if (!FT_IS_SCALABLE(fFace) && fScaleY && fFace->size->metrics.y_ppem) {
+ if (!FT_IS_SCALABLE(fFace) && !SkScalarNearlyZero(fScale.fY) && fFace->size->metrics.y_ppem) {
// NOTE: both dimensions are scaled by y_ppem. this is WAI.
- scaleGlyphMetrics(*glyph, SkFixedToScalar(fScaleY) / fFace->size->metrics.y_ppem);
+ scaleGlyphMetrics(*glyph, fScale.fY / fFace->size->metrics.y_ppem);
}
#ifdef ENABLE_GLYPH_SPEW