| Index: src/gpu/GrSurface.cpp
|
| diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
|
| index 886945c71036052812e3e0e003ad931b1dfd672d..b157cf2028612d87e872416726fe22ca3491cbd5 100644
|
| --- a/src/gpu/GrSurface.cpp
|
| +++ b/src/gpu/GrSurface.cpp
|
| @@ -19,17 +19,20 @@ size_t GrSurface::WorseCaseSize(const GrSurfaceDesc& desc) {
|
|
|
| bool isRenderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
|
| if (isRenderTarget) {
|
| + // We own one color value for texture storing the rendering result,
|
| + // e.g. the actual fbo texture attachment or the resolve texture.
|
| // We own one color value for each MSAA sample.
|
| - int colorValuesPerPixel = SkTMax(1, desc.fSampleCnt);
|
| - if (desc.fSampleCnt) {
|
| - // Worse case, we own the resolve buffer so that is one more sample per pixel.
|
| - colorValuesPerPixel += 1;
|
| - }
|
| + size_t colorValues = 1 + static_cast<size_t>(desc.fSampleCnt);
|
| +
|
| SkASSERT(kUnknown_GrPixelConfig != desc.fConfig);
|
| SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig));
|
| size_t colorBytes = GrBytesPerPixel(desc.fConfig);
|
| SkASSERT(colorBytes > 0);
|
| - size = colorValuesPerPixel * desc.fWidth * desc.fHeight * colorBytes;
|
| + size_t bytesPerColorValue = desc.fWidth * desc.fHeight * colorBytes;
|
| + size = colorValues * bytesPerColorValue;
|
| + // Render target that is a texture might have mipmaps in the
|
| + // rendering target texture.
|
| + size += bytesPerColorValue / 3;
|
| } else {
|
| if (GrPixelConfigIsCompressed(desc.fConfig)) {
|
| size = GrCompressedFormatDataSize(desc.fConfig, desc.fWidth, desc.fHeight);
|
|
|