Fix fuzzer bug

BUG=663687

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4580

Change-Id: I9e914a1134b8049cf62bb36d4a6145eb8487d4e6
Reviewed-on: https://skia-review.googlesource.com/4580
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2016-11-09 08:03:21 -05:00 committed by Skia Commit-Bot
parent 3743013f75
commit 68b7a52a0b

View File

@ -38,7 +38,7 @@ size_t GrSurface::WorstCaseSize(const GrSurfaceDesc& desc) {
}
SkASSERT(kUnknown_GrPixelConfig != desc.fConfig);
SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig));
size_t colorBytes = desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig);
size_t colorBytes = (size_t) desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig);
// This would be a nice assert to have (i.e., we aren't creating 0 width/height surfaces).
// Unfortunately Chromium seems to want to do this.
@ -50,7 +50,7 @@ size_t GrSurface::WorstCaseSize(const GrSurfaceDesc& desc) {
if (GrPixelConfigIsCompressed(desc.fConfig)) {
size = GrCompressedFormatDataSize(desc.fConfig, desc.fWidth, desc.fHeight);
} else {
size = desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig);
size = (size_t) desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig);
}
size += size/3; // in case we have to mipmap
@ -68,7 +68,7 @@ size_t GrSurface::ComputeSize(const GrSurfaceDesc& desc,
if (GrPixelConfigIsCompressed(desc.fConfig)) {
colorSize = GrCompressedFormatDataSize(desc.fConfig, desc.fWidth, desc.fHeight);
} else {
colorSize = desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig);
colorSize = (size_t) desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig);
}
SkASSERT(colorSize > 0);