Chromium Code Reviews| Index: src/gpu/GrTexture.cpp |
| diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp |
| index f8515153710e089950de84390853a0569fa08aff..b8082be0a8fcf714855d623b02c148b0aad9e061 100644 |
| --- a/src/gpu/GrTexture.cpp |
| +++ b/src/gpu/GrTexture.cpp |
| @@ -44,6 +44,33 @@ void GrTexture::internal_dispose() const { |
| this->INHERITED::internal_dispose(); |
| } |
| +void GrTexture::dirtyMipMaps(bool mipMapsDirty) { |
| + if (mipMapsDirty) { |
| + if (kValid_MipMapsStatus == fMipMapsStatus) { |
| + fMipMapsStatus = kInvalid_MipMapsStatus; |
| + } |
| + } else { |
| + const bool sizeChanged = kNotAllocated_MipMapsStatus == fMipMapsStatus; |
| + fMipMapsStatus = kValid_MipMapsStatus; |
| + if (sizeChanged) { |
| + // This must not be called until after changing fMipMapsStatus. |
| + this->didChangeGpuMemorySize(); |
| + } |
| + } |
| +} |
| + |
|
robertphillips
2014/04/29 13:46:25
no SK_OVERRIDE here
|
| +size_t GrTexture::gpuMemorySize() const SK_OVERRIDE { |
| + size_t textureSize = (size_t) fDesc.fWidth * |
| + fDesc.fHeight * |
| + GrBytesPerPixel(fDesc.fConfig); |
| + if (kNotAllocated_MipMapsStatus != fMipMapsStatus) { |
| + // We don't have to worry about the mipmaps being a different size than |
| + // we'd expect because we never change fDesc.fWidth/fHeight. |
| + textureSize *= 2; |
| + } |
| + return textureSize; |
| +} |
| + |
| bool GrTexture::readPixels(int left, int top, int width, int height, |
| GrPixelConfig config, void* buffer, |
| size_t rowBytes, uint32_t pixelOpsFlags) { |