State reset and gpu timers added.
git-svn-id: http://skia.googlecode.com/svn/trunk@5177 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 4142fa4..84e7f85 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -54,10 +54,22 @@
}
void PictureRenderer::end() {
+ this->resetState();
fPicture = NULL;
fCanvas.reset(NULL);
}
+void PictureRenderer::resetState() {
+ fCanvas->flush();
+
+ if (this->isUsingGpuDevice()) {
+ SkGLContext* glContext = fGrContextFactory.getGLContext(
+ GrContextFactory::kNative_GLContextType);
+ SK_GL(*glContext, Finish());
+ fGrContext->freeGpuResources();
+ }
+}
+
void PipePictureRenderer::render() {
SkASSERT(fCanvas.get() != NULL);
SkASSERT(fPicture != NULL);