diff options
Diffstat (limited to 'include/core/SkImageInfo.h')
-rw-r--r-- | include/core/SkImageInfo.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h index f659bf7742..e8a06cb0d1 100644 --- a/include/core/SkImageInfo.h +++ b/include/core/SkImageInfo.h @@ -300,6 +300,7 @@ public: void unflatten(SkReadBuffer&); void flatten(SkWriteBuffer&) const; +#ifdef SK_SUPPORT_LEGACY_SAFESIZE64 int64_t getSafeSize64(size_t rowBytes) const { if (0 == fHeight) { return 0; @@ -314,6 +315,22 @@ public: } return sk_64_asS32(size); } +#endif + + /** + * 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. + */ + size_t computeByteSize(size_t rowBytes) const; + + /** + * Returns the minimum size (in bytes) of the image buffer that this info needs. + * If the calculation overflows, or if the height is 0, this returns 0. + */ + size_t computeMinByteSize() const { + return this->computeByteSize(this->minRowBytes()); + } bool validRowBytes(size_t rowBytes) const { uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); |