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

Unified Diff: include/utils/SkMatrix44.h

Issue 645793006: add round/ceil/etc. for SkMScalar (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add test Created 6 years, 2 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 | « include/core/SkFloatingPoint.h ('k') | tests/Matrix44Test.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/utils/SkMatrix44.h
diff --git a/include/utils/SkMatrix44.h b/include/utils/SkMatrix44.h
index 38a011467f96c01392bc91cf941853c709b1e051..553e8d7c4f9d0551e73f4bf97368b6d29e6b2d83 100644
--- a/include/utils/SkMatrix44.h
+++ b/include/utils/SkMatrix44.h
@@ -33,6 +33,16 @@
return fabs(x);
}
static const SkMScalar SK_MScalarPI = 3.141592653589793;
+
+ #define SkMScalarFloor(x) sk_double_floor(x)
+ #define SkMScalarCeil(x) sk_double_ceil(x)
+ #define SkMScalarRound(x) sk_double_round(x)
+
+ #define SkMScalarFloorToInt(x) sk_double_floor2int(x)
+ #define SkMScalarCeilToInt(x) sk_double_ceil2int(x)
+ #define SkMScalarRoundToInt(x) sk_double_round2int(x)
+
+
#elif defined SK_MSCALAR_IS_FLOAT
#ifdef SK_MSCALAR_IS_DOUBLE
#error "can't define MSCALAR both as DOUBLE and FLOAT"
@@ -55,10 +65,21 @@
return sk_float_abs(x);
}
static const SkMScalar SK_MScalarPI = 3.14159265f;
+
+ #define SkMScalarFloor(x) sk_float_floor(x)
+ #define SkMScalarCeil(x) sk_float_ceil(x)
+ #define SkMScalarRound(x) sk_float_round(x)
+
+ #define SkMScalarFloorToInt(x) sk_float_floor2int(x)
+ #define SkMScalarCeilToInt(x) sk_float_ceil2int(x)
+ #define SkMScalarRoundToInt(x) sk_float_round2int(x)
+
#endif
-#define SkMScalarToScalar SkMScalarToFloat
-#define SkScalarToMScalar SkFloatToMScalar
+#define SkIntToMScalar(n) static_cast<SkMScalar>(n)
+
+#define SkMScalarToScalar(x) SkMScalarToFloat(x)
+#define SkScalarToMScalar(x) SkFloatToMScalar(x)
static const SkMScalar SK_MScalar1 = 1;
« no previous file with comments | « include/core/SkFloatingPoint.h ('k') | tests/Matrix44Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698