Fix VisualBench to hold onto a surface

BUG=skia:

Review URL: https://codereview.chromium.org/1236723003
This commit is contained in:
joshualitt 2015-07-15 06:18:57 -07:00 committed by Commit bot
parent 108b5b2c23
commit d4fa90feea

View File

@ -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() {