Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Unified Diff: src/gpu/GrTexture.cpp

Issue 257093002: Add size change notifications to GrResourceCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698