Index: tools/PictureRenderer.cpp |
=================================================================== |
--- tools/PictureRenderer.cpp (revision 12709) |
+++ tools/PictureRenderer.cpp (working copy) |
@@ -12,6 +12,7 @@ |
#include "SkCanvas.h" |
#include "SkData.h" |
#include "SkDevice.h" |
+#include "SkDiscardableMemoryPool.h" |
#include "SkGPipe.h" |
#if SK_SUPPORT_GPU |
#include "gl/GrGLDefines.h" |
@@ -34,6 +35,15 @@ |
#include "SkThreadUtils.h" |
#include "SkTypes.h" |
+class SkTools_PictureRenderer { |
+private: |
+ static void PurgeAllUnlockedTextures(GrContext* context) { |
+ context->purgeAllUnlocked(); |
+ } |
+ |
+ friend class sk_tools::PictureRenderer; |
+}; |
+ |
namespace sk_tools { |
enum { |
@@ -240,6 +250,25 @@ |
#endif |
} |
+void PictureRenderer::purgeTextures() { |
+ SkDiscardableMemoryPool* pool = SkGetGlobalDiscardableMemoryPool(); |
+ |
+ pool->dumpPool(); |
+ |
+#if SK_SUPPORT_GPU |
+ SkGLContextHelper* glContext = this->getGLContext(); |
+ if (NULL == glContext) { |
+ SkASSERT(kBitmap_DeviceType == fDeviceType); |
+ return; |
+ } |
+ |
+ // resetState should've already done this |
+ fGrContext->flush(); |
+ |
+ SkTools_PictureRenderer::PurgeAllUnlockedTextures(fGrContext); |
+#endif |
+} |
+ |
uint32_t PictureRenderer::recordFlags() { |
return ((kNone_BBoxHierarchyType == fBBoxHierarchyType) ? 0 : |
SkPicture::kOptimizeForClippedPlayback_RecordingFlag) | |