remove dead code for returning 0 on overflow
Bug: skia: Change-Id: I6e7aae1b09cf3a1c9728bdaaa4dbf4df4b2ec16d Reviewed-on: https://skia-review.googlesource.com/58341 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
019f91e123
commit
3758c755d4
@ -317,19 +317,18 @@ 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 (height == 0) {
|
||||
* return 0;
|
||||
* } else {
|
||||
* return (height - 1) * rowBytes + width * bytes_per_pixel;
|
||||
* }
|
||||
*
|
||||
* If the calculation overflows this returns SK_MaxSizeT
|
||||
*/
|
||||
#endif
|
||||
size_t computeByteSize(size_t rowBytes) const;
|
||||
|
||||
/**
|
||||
|
@ -78,11 +78,7 @@ size_t SkImageInfo::computeByteSize(size_t rowBytes) const {
|
||||
SkSafeMath safe;
|
||||
size_t bytes = safe.add(safe.mul(fHeight - 1, rowBytes),
|
||||
safe.mul(fWidth, this->bytesPerPixel()));
|
||||
#ifdef SK_SUPPORT_LEGACY_COMPUTEBYTESIZE_RET_0
|
||||
return safe ? bytes : 0;
|
||||
#else
|
||||
return safe ? bytes : SK_MaxSizeT;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool alpha_type_is_valid(SkAlphaType alphaType) {
|
||||
|
Loading…
Reference in New Issue
Block a user