diff options
author | Mike Reed <reed@google.com> | 2017-10-09 11:37:44 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-09 16:05:34 +0000 |
commit | 72818018494372b8692203b77aedfa6b8a87e3bc (patch) | |
tree | 59dee65189262f13811768ea965418862e7365e1 /include/core/SkImageInfo.h | |
parent | 16e92cdd91bd46e2909465a7509960a3ca2eeeb6 (diff) |
Revert "Revert "change computeByteSize to return max_size_t on overflow""
This reverts commit 384f0a7d6626026f21313e85e51890d747171ee8.
Bug: skia:
Change-Id: I392ef5c1a5172181caf81ae270befeba6e778241
Reviewed-on: https://skia-review.googlesource.com/57084
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'include/core/SkImageInfo.h')
-rw-r--r-- | include/core/SkImageInfo.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h index 212d96ef5e..fa3797bbb5 100644 --- a/include/core/SkImageInfo.h +++ b/include/core/SkImageInfo.h @@ -317,11 +317,19 @@ public: } #endif +#ifdef SK_SUPPORT_LEGACY_COMPUTEBYTESIZE_RET_0 /** * Returns the size (in bytes) of the image buffer that this info needs, given the specified * rowBytes. The rowBytes must be >= this->minRowBytes(). * If the calculation overflows, or if the height is 0, this returns 0. */ +#else + /** + * Returns the size (in bytes) of the image buffer that this info needs, given the specified + * rowBytes. The rowBytes must be >= this->minRowBytes(). + * If the calculation overflows this returns SK_MaxSizeT + */ +#endif size_t computeByteSize(size_t rowBytes) const; /** @@ -334,7 +342,11 @@ public: // Returns true if the result of computeByteSize (or computeMinByteSize) overflowed static bool ByteSizeOverflowed(size_t byteSize) { +#ifdef SK_SUPPORT_LEGACY_COMPUTEBYTESIZE_RET_0 return 0 == byteSize; +#else + return SK_MaxSizeT == byteSize; +#endif } bool validRowBytes(size_t rowBytes) const { |