Update bench pictures to time image decode & upload costs
https://codereview.chromium.org/117583002/
git-svn-id: http://skia.googlecode.com/svn/trunk@12742 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 54d4633..4856dd2 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -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"
@@ -246,6 +247,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();
+
+ fGrContext->purgeAllUnlockedResources();
+#endif
+}
+
uint32_t PictureRenderer::recordFlags() {
return ((kNone_BBoxHierarchyType == fBBoxHierarchyType) ? 0 :
SkPicture::kOptimizeForClippedPlayback_RecordingFlag) |