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

Unified Diff: src/pdf/SkPDFDevice.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/gpu/text/GrTextUtils.cpp ('k') | src/pdf/SkPDFFont.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFDevice.cpp
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 66048ff751f0210418d411043d4a3f3b09326037..35ed58cea8ab47f33efddbbfa5d7081a44667202 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -95,26 +95,24 @@ static void align_text(SkPaint::GlyphCacheProc glyphCacheProc, const SkPaint& pa
const char* start = reinterpret_cast<const char*>(glyphs);
const char* stop = reinterpret_cast<const char*>(glyphs + len);
- SkFixed xAdv = 0, yAdv = 0;
+ SkScalar xAdv = 0, yAdv = 0;
// TODO(vandebo): This probably needs to take kerning into account.
while (start < stop) {
const SkGlyph& glyph = glyphCacheProc(cache, &start);
- xAdv += glyph.fAdvanceX;
- yAdv += glyph.fAdvanceY;
+ xAdv += SkFloatToScalar(glyph.fAdvanceX);
+ yAdv += SkFloatToScalar(glyph.fAdvanceY);
};
if (paint.getTextAlign() == SkPaint::kLeft_Align) {
return;
}
- SkScalar xAdj = SkFixedToScalar(xAdv);
- SkScalar yAdj = SkFixedToScalar(yAdv);
if (paint.getTextAlign() == SkPaint::kCenter_Align) {
- xAdj = SkScalarHalf(xAdj);
- yAdj = SkScalarHalf(yAdj);
+ xAdv = SkScalarHalf(xAdv);
+ yAdv = SkScalarHalf(yAdv);
}
- *x = *x - xAdj;
- *y = *y - yAdj;
+ *x = *x - xAdv;
+ *y = *y - yAdv;
}
static int max_glyphid_for_typeface(SkTypeface* typeface) {
« no previous file with comments | « src/gpu/text/GrTextUtils.cpp ('k') | src/pdf/SkPDFFont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698