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

Unified Diff: include/core/SkScalar.h

Issue 977623002: Glyph positions maintain 32 bit integer part. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use Sk48Dot6, do no fixed math. 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
Index: include/core/SkScalar.h
diff --git a/include/core/SkScalar.h b/include/core/SkScalar.h
index 3c1787ed2da5ead04788b16ba50cbb8e9116b127..1b8c0dd4f01095b2865f5e991bff35026f96515a 100644
--- a/include/core/SkScalar.h
+++ b/include/core/SkScalar.h
@@ -169,11 +169,15 @@ static inline int SkDScalarRoundToInt(SkScalar x) {
}
static inline SkScalar SkScalarClampMax(SkScalar x, SkScalar max) {
- return x < 0 ? 0 : x > max ? max : x;
+ x = SkTMin(x, max);
+ x = SkTMax(x, SkIntToScalar(0));
reed1 2015/03/09 16:33:56 I actually think SkIntToScalar(0) is harder to rea
bungeman-skia 2015/03/09 17:49:12 I went and pulled this change out into it's own re
+ return x;
}
static inline SkScalar SkScalarPin(SkScalar x, SkScalar min, SkScalar max) {
- return x < min ? min : x > max ? max : x;
+ x = SkTMin(x, max);
+ x = SkTMax(x, min);
+ return x;
}
SkScalar SkScalarSinCos(SkScalar radians, SkScalar* cosValue);

Powered by Google App Engine
This is Rietveld 408576698