Index: src/gpu/GrTexture.cpp |
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp |
index 8651d1090ec96529f08d19008f7eb8ae008e8fa7..15dd89cc2bb28e42c015aa78c72358d7746a333d 100644 |
--- a/src/gpu/GrTexture.cpp |
+++ b/src/gpu/GrTexture.cpp |
@@ -62,6 +62,21 @@ size_t GrTexture::gpuMemorySize() const { |
size_t textureSize = (size_t) fDesc.fWidth * |
fDesc.fHeight * |
GrBytesPerPixel(fDesc.fConfig); |
+ |
+ if (GrPixelConfigIsCompressed(fDesc.fConfig)) { |
+ // Figure out the width and height corresponding to the data... |
+ SkASSERT((fDesc.fWidth & 3) == 0); |
+ SkASSERT((fDesc.fHeight & 3) == 0); |
+ |
robertphillips
2014/05/29 12:53:18
// Both these formats have 4x4 blocks of 8 bytes ?
krajcevski
2014/05/29 14:28:22
Done.
|
+ if (kETC1_GrPixelConfig == fDesc.fConfig) { |
+ textureSize = (fDesc.fWidth >> 2) * (fDesc.fHeight >> 2) * 8; |
+ } else if (kLATC_GrPixelConfig == fDesc.fConfig) { |
+ textureSize = (fDesc.fWidth >> 2) * (fDesc.fHeight >> 2) * 8; |
+ } else { |
robertphillips
2014/05/29 12:53:18
Maybe: SkFAIL("Unknown compression format"); retur
krajcevski
2014/05/29 14:28:22
Done.
|
+ SkASSERT(false); |
+ } |
+ } |
+ |
if (this->impl()->hasMipMaps()) { |
// We don't have to worry about the mipmaps being a different size than |
// we'd expect because we never change fDesc.fWidth/fHeight. |