Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: tools/VisualBench/VisualBench.cpp

Issue 1236723003: Fix VisualBench to hold onto a surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698