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

Unified Diff: src/fonts/SkTestScalerContext.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/fonts/SkGScalerContext.cpp ('k') | src/gpu/text/GrStencilAndCoverTextContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/fonts/SkTestScalerContext.cpp
diff --git a/src/fonts/SkTestScalerContext.cpp b/src/fonts/SkTestScalerContext.cpp
index 7afe6521a3ab3220779591f64d4756d1280feb78..600e2de609c49fde3d31394742118faee1d4d045 100644
--- a/src/fonts/SkTestScalerContext.cpp
+++ b/src/fonts/SkTestScalerContext.cpp
@@ -120,7 +120,8 @@ SkTestTypeface::SkTestTypeface(SkTestFont* testFont, const SkFontStyle& style)
}
void SkTestTypeface::getAdvance(SkGlyph* glyph) {
- glyph->fAdvanceX = fTestFont->fWidths[glyph->getGlyphID()];
+ // TODO(benjaminwagner): Update users to use floats.
+ glyph->fAdvanceX = SkFixedToFloat(fTestFont->fWidths[glyph->getGlyphID()]);
glyph->fAdvanceY = 0;
}
@@ -129,7 +130,8 @@ void SkTestTypeface::getFontMetrics(SkPaint::FontMetrics* metrics) {
}
void SkTestTypeface::getMetrics(SkGlyph* glyph) {
- glyph->fAdvanceX = fTestFont->fWidths[glyph->getGlyphID()];
+ // TODO(benjaminwagner): Update users to use floats.
+ glyph->fAdvanceX = SkFixedToFloat(fTestFont->fWidths[glyph->getGlyphID()]);
glyph->fAdvanceY = 0;
}
@@ -206,19 +208,19 @@ protected:
void generateAdvance(SkGlyph* glyph) override {
fFace->getAdvance(glyph);
- const SkVector advance = fMatrix.mapXY(SkFixedToScalar(glyph->fAdvanceX),
- SkFixedToScalar(glyph->fAdvanceY));
- glyph->fAdvanceX = SkScalarToFixed(advance.fX);
- glyph->fAdvanceY = SkScalarToFixed(advance.fY);
+ const SkVector advance = fMatrix.mapXY(SkFloatToScalar(glyph->fAdvanceX),
+ SkFloatToScalar(glyph->fAdvanceY));
+ glyph->fAdvanceX = SkScalarToFloat(advance.fX);
+ glyph->fAdvanceY = SkScalarToFloat(advance.fY);
}
void generateMetrics(SkGlyph* glyph) override {
fFace->getMetrics(glyph);
- const SkVector advance = fMatrix.mapXY(SkFixedToScalar(glyph->fAdvanceX),
- SkFixedToScalar(glyph->fAdvanceY));
- glyph->fAdvanceX = SkScalarToFixed(advance.fX);
- glyph->fAdvanceY = SkScalarToFixed(advance.fY);
+ const SkVector advance = fMatrix.mapXY(SkFloatToScalar(glyph->fAdvanceX),
+ SkFloatToScalar(glyph->fAdvanceY));
+ glyph->fAdvanceX = SkScalarToFloat(advance.fX);
+ glyph->fAdvanceY = SkScalarToFloat(advance.fY);
SkPath path;
fFace->getPath(*glyph, &path);
« no previous file with comments | « src/fonts/SkGScalerContext.cpp ('k') | src/gpu/text/GrStencilAndCoverTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698