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

Unified Diff: src/core/SkTextMapStateProc.h

Issue 977623002: Glyph positions maintain 32 bit integer part. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Branchless (on Clang). Created 5 years, 10 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
« include/core/SkScalar.h ('K') | « include/core/SkScalar.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTextMapStateProc.h
diff --git a/src/core/SkTextMapStateProc.h b/src/core/SkTextMapStateProc.h
index 8ef9389b3ab5f07d3ae76654ef922cf33f04e5d4..489025d8e8f4e5bcfede3834e9da1df17dc89def 100644
--- a/src/core/SkTextMapStateProc.h
+++ b/src/core/SkTextMapStateProc.h
@@ -55,6 +55,10 @@ private:
SkScalar fScaleX; // This is only used by kOnly... cases.
};
+static inline SkScalar SkClampScalarToFixed(SkScalar a) {
+ return SkScalarPin(a, SkIntToScalar(-16384), SkIntToScalar(16384));
mtklein 2015/03/04 21:45:30 What fixed format are we clamping to? Signed 1.14
bungeman-skia 2015/03/04 21:57:35 This is SkFixed we're clamping to. SkFixed is symm
mtklein 2015/03/04 22:11:00 Oh, duh, we're clamping SkScalars, not SkFixed. O
reed1 2015/03/05 18:27:35 Lets modify its name to make it more obvious that
+}
+
inline void SkTextMapStateProc::operator()(const SkScalar pos[], SkPoint* loc) const {
switch(fMapCase) {
case kXY:
@@ -72,6 +76,7 @@ inline void SkTextMapStateProc::operator()(const SkScalar pos[], SkPoint* loc) c
fProc(fMatrix, *pos + fOffset.x(), fOffset.y(), loc);
break;
}
+ loc->set(SkClampScalarToFixed(loc->x()), SkClampScalarToFixed(loc->y()));
}
#endif
« include/core/SkScalar.h ('K') | « include/core/SkScalar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698