Index: tools/VisualBench/VisualBench.cpp |
diff --git a/tools/VisualBench/VisualBench.cpp b/tools/VisualBench/VisualBench.cpp |
index 6501aa36b2bcaaf6df6a05d06687601f80ee97be..136162aece9f554f3f35571119088f1a6ed1457f 100644 |
--- a/tools/VisualBench/VisualBench.cpp |
+++ b/tools/VisualBench/VisualBench.cpp |
@@ -74,8 +74,13 @@ void VisualBench::setTitle() { |
} |
SkSurface* VisualBench::createSurface() { |
- SkSurfaceProps props(INHERITED::getSurfaceProps()); |
- return SkSurface::NewRenderTargetDirect(fRenderTarget, &props); |
+ if (!fSurface) { |
+ SkSurfaceProps props(INHERITED::getSurfaceProps()); |
+ fSurface.reset(SkSurface::NewRenderTargetDirect(fRenderTarget, &props)); |
+ } |
+ |
+ // The caller will wrap the SkSurface in an SkAutoTUnref |
+ return SkRef(fSurface.get()); |
} |
bool VisualBench::setupBackend() { |