aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkImageInfo.h10
-rw-r--r--include/core/SkTypes.h15
2 files changed, 15 insertions, 10 deletions
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index a60f26576d..0d9583e012 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -555,7 +555,7 @@ public:
and rowBytes. rowBytes is assumed to be at least as large as minRowBytes().
Returns zero if height is zero.
- Returns SIZE_MAX if answer exceeds the range of size_t.
+ Returns SK_MaxSizeT if answer exceeds the range of size_t.
@param rowBytes size of pixel row or larger
@return memory required by pixel buffer
@@ -566,7 +566,7 @@ public:
SkColorType. Uses minRowBytes() to compute bytes for pixel row.
Returns zero if height is zero.
- Returns SIZE_MAX if answer exceeds the range of size_t.
+ Returns SK_MaxSizeT if answer exceeds the range of size_t.
@return least memory required by pixel buffer
*/
@@ -574,14 +574,14 @@ public:
return this->computeByteSize(this->minRowBytes());
}
- /** Returns true if byteSize equals SIZE_MAX. computeByteSize() and
- computeMinByteSize() return SIZE_MAX if size_t can not hold buffer size.
+ /** Returns true if byteSize equals SK_MaxSizeT. computeByteSize() and
+ computeMinByteSize() return SK_MaxSizeT if size_t can not hold buffer size.
@param byteSize result of computeByteSize() or computeMinByteSize()
@return true if computeByteSize() or computeMinByteSize() result exceeds size_t
*/
static bool ByteSizeOverflowed(size_t byteSize) {
- return SIZE_MAX == byteSize;
+ return SK_MaxSizeT == byteSize;
}
/** Returns true if rowBytes is smaller than width times pixel size.
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index e624d4518c..f906816587 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -100,12 +100,17 @@ typedef unsigned U16CPU;
*/
#define SkToBool(cond) ((cond) != 0)
-#define SK_MaxS16 INT16_MAX
-#define SK_MinS16 -SK_MaxS16
-#define SK_MaxS32 INT32_MAX
+#define SK_MaxS16 32767
+#define SK_MinS16 -32767
+#define SK_MaxU16 0xFFFF
+#define SK_MinU16 0
+#define SK_MaxS32 0x7FFFFFFF
#define SK_MinS32 -SK_MaxS32
-#define SK_NaN32 INT32_MIN
-static constexpr int64_t SK_MaxS64 = INT64_MAX;
+#define SK_MaxU32 0xFFFFFFFF
+#define SK_MinU32 0
+#define SK_NaN32 ((int) (1U << 31))
+#define SK_MaxSizeT SIZE_MAX
+static constexpr int64_t SK_MaxS64 = 0x7FFFFFFFFFFFFFFF;
static constexpr int64_t SK_MinS64 = -SK_MaxS64;
static inline constexpr int32_t SkLeftShift(int32_t value, int32_t shift) {