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

Unified Diff: src/gpu/text/GrStencilAndCoverTextContext.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/SkTestScalerContext.cpp ('k') | src/gpu/text/GrTextUtils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/text/GrStencilAndCoverTextContext.cpp
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index 661f22512d41ecdf592e6452b5de97d1eb377be1..4c2a615a663f0d318de04e70b782b400b5bc4279 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -457,8 +457,8 @@ void GrStencilAndCoverTextContext::TextRun::setText(const char text[], size_t by
// Measure first if needed.
if (fFont.getTextAlign() != SkPaint::kLeft_Align) {
- SkFixed stopX = 0;
- SkFixed stopY = 0;
+ SkScalar stopX = 0;
+ SkScalar stopY = 0;
const char* textPtr = text;
while (textPtr < stop) {
@@ -466,13 +466,13 @@ void GrStencilAndCoverTextContext::TextRun::setText(const char text[], size_t by
// same advance.
const SkGlyph& glyph = glyphCacheProc(glyphCache, &textPtr);
- stopX += glyph.fAdvanceX;
- stopY += glyph.fAdvanceY;
+ stopX += SkFloatToScalar(glyph.fAdvanceX);
+ stopY += SkFloatToScalar(glyph.fAdvanceY);
}
SkASSERT(textPtr == stop);
- SkScalar alignX = SkFixedToScalar(stopX) * fTextRatio;
- SkScalar alignY = SkFixedToScalar(stopY) * fTextRatio;
+ SkScalar alignX = stopX * fTextRatio;
+ SkScalar alignY = stopY * fTextRatio;
if (fFont.getTextAlign() == SkPaint::kCenter_Align) {
alignX = SkScalarHalf(alignX);
@@ -485,21 +485,16 @@ void GrStencilAndCoverTextContext::TextRun::setText(const char text[], size_t by
SkAutoKern autokern;
- SkFixed fixedSizeRatio = SkScalarToFixed(fTextRatio);
-
- SkFixed fx = SkScalarToFixed(x);
- SkFixed fy = SkScalarToFixed(y);
FallbackBlobBuilder fallback;
while (text < stop) {
const SkGlyph& glyph = glyphCacheProc(glyphCache, &text);
- fx += SkFixedMul(autokern.adjust(glyph), fixedSizeRatio);
+ x += autokern.adjust(glyph) * fTextRatio;
if (glyph.fWidth) {
- this->appendGlyph(glyph, SkPoint::Make(SkFixedToScalar(fx), SkFixedToScalar(fy)),
- &fallback);
+ this->appendGlyph(glyph, SkPoint::Make(x, y), &fallback);
}
- fx += SkFixedMul(glyph.fAdvanceX, fixedSizeRatio);
- fy += SkFixedMul(glyph.fAdvanceY, fixedSizeRatio);
+ x += SkFloatToScalar(glyph.fAdvanceX) * fTextRatio;
+ y += SkFloatToScalar(glyph.fAdvanceY) * fTextRatio;
}
fFallbackTextBlob.reset(fallback.buildIfNeeded(&fFallbackGlyphCount));
« no previous file with comments | « src/fonts/SkTestScalerContext.cpp ('k') | src/gpu/text/GrTextUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698