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

Unified Diff: include/private/SkFixed.h

Issue 1952303005: Remove Sk(Float|Double)PinToFixed functions, only used in tests. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | tests/MathTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/private/SkFixed.h
diff --git a/include/private/SkFixed.h b/include/private/SkFixed.h
index dade2399d13f458e1f0ba816ef29dbf734a4e8fb..640f0e7ea3e1316f3d1139f3d6653bfaaed6a26c 100644
--- a/include/private/SkFixed.h
+++ b/include/private/SkFixed.h
@@ -33,17 +33,6 @@ typedef int32_t SkFixed;
#define SkFixedToFloat(x) ((x) * 1.52587890625e-5f)
#define SkFloatToFixed(x) ((SkFixed)((x) * SK_Fixed1))
-// Pins over/under flows to SK_FixedMax/SK_FixedMin (slower than just a cast).
-static inline SkFixed SkFloatPinToFixed(float x) {
- x *= SK_Fixed1;
- // Casting float to int outside the range of the target type (int32_t) is undefined behavior.
- if (x >= SK_FixedMax) return SK_FixedMax;
- if (x <= SK_FixedMin) return SK_FixedMin;
- const SkFixed result = static_cast<SkFixed>(x);
- SkASSERT(truncf(x) == static_cast<float>(result));
- return result;
-}
-
#ifdef SK_DEBUG
static inline SkFixed SkFloatToFixed_Check(float x) {
int64_t n64 = (int64_t)(x * SK_Fixed1);
@@ -58,17 +47,6 @@ static inline SkFixed SkFloatPinToFixed(float x) {
#define SkFixedToDouble(x) ((x) * 1.52587890625e-5)
#define SkDoubleToFixed(x) ((SkFixed)((x) * SK_Fixed1))
-// Pins over/under flows to SK_FixedMax/SK_FixedMin (slower than just a cast).
-static inline SkFixed SkDoublePinToFixed(double x) {
- x *= SK_Fixed1;
- // Casting double to int outside the range of the target type (int32_t) is undefined behavior.
- if (x >= SK_FixedMax) return SK_FixedMax;
- if (x <= SK_FixedMin) return SK_FixedMin;
- const SkFixed result = static_cast<SkFixed>(x);
- SkASSERT(trunc(x) == static_cast<double>(result));
- return result;
-}
-
/** Converts an integer to a SkFixed, asserting that the result does not overflow
a 32 bit signed integer
*/
@@ -158,13 +136,11 @@ inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) {
#define SkFixedToScalar(x) SkFixedToFloat(x)
#define SkScalarToFixed(x) SkFloatToFixed(x)
-#define SkScalarPinToFixed(x) SkFloatPinToFixed(x)
#else // SK_SCALAR_IS_DOUBLE
#define SkFixedToScalar(x) SkFixedToDouble(x)
#define SkScalarToFixed(x) SkDoubleToFixed(x)
-#define SkScalarPinToFixed(x) SkDoublePinToFixed(x)
#endif
« no previous file with comments | « no previous file | tests/MathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698