Free cached AA clip mask when create hard/stencil clip mask
http://codereview.appspot.com/6214050/
git-svn-id: http://skia.googlecode.com/svn/trunk@3983 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 15aae1e..f8e81a3 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -121,6 +121,15 @@
}
#endif // GR_AA_CLIP
+ // Either a hard (stencil buffer) clip was explicitly requested or
+ // an antialiased clip couldn't be created. In either case, free up
+ // the texture in the antialiased mask cache.
+ // TODO: this may require more investigation. Ganesh performs a lot of
+ // utility draws (e.g., clears, InOderDrawBuffer playbacks) that hit
+ // the stencil buffer path. These may be incorrectly messing up the
+ // AA cache.
+ fAACache.reset();
+
GrRect bounds;
GrRect rtRect;
rtRect.setLTRB(0, 0,
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 5ec6511..bd6d829 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -67,6 +67,11 @@
GrContext::~GrContext() {
this->flush();
+
+ // Since the gpu can hold scratch textures, give it a chance to let go
+ // of them before freeing the texture cache
+ fGpu->purgeResources();
+
delete fTextureCache;
delete fFontCache;
delete fDrawBuffer;