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:
parent
3743013f75
commit
68b7a52a0b
@ -38,7 +38,7 @@ size_t GrSurface::WorstCaseSize(const GrSurfaceDesc& desc) {
|
|||||||
}
|
}
|
||||||
SkASSERT(kUnknown_GrPixelConfig != desc.fConfig);
|
SkASSERT(kUnknown_GrPixelConfig != desc.fConfig);
|
||||||
SkASSERT(!GrPixelConfigIsCompressed(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).
|
// 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.
|
// Unfortunately Chromium seems to want to do this.
|
||||||
@ -50,7 +50,7 @@ size_t GrSurface::WorstCaseSize(const GrSurfaceDesc& desc) {
|
|||||||
if (GrPixelConfigIsCompressed(desc.fConfig)) {
|
if (GrPixelConfigIsCompressed(desc.fConfig)) {
|
||||||
size = GrCompressedFormatDataSize(desc.fConfig, desc.fWidth, desc.fHeight);
|
size = GrCompressedFormatDataSize(desc.fConfig, desc.fWidth, desc.fHeight);
|
||||||
} else {
|
} 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
|
size += size/3; // in case we have to mipmap
|
||||||
@ -68,7 +68,7 @@ size_t GrSurface::ComputeSize(const GrSurfaceDesc& desc,
|
|||||||
if (GrPixelConfigIsCompressed(desc.fConfig)) {
|
if (GrPixelConfigIsCompressed(desc.fConfig)) {
|
||||||
colorSize = GrCompressedFormatDataSize(desc.fConfig, desc.fWidth, desc.fHeight);
|
colorSize = GrCompressedFormatDataSize(desc.fConfig, desc.fWidth, desc.fHeight);
|
||||||
} else {
|
} else {
|
||||||
colorSize = desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig);
|
colorSize = (size_t) desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig);
|
||||||
}
|
}
|
||||||
SkASSERT(colorSize > 0);
|
SkASSERT(colorSize > 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user