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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 * 6 *
7 */ 7 */
8 8
9 #include "VisualBench.h" 9 #include "VisualBench.h"
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 VisualBench::~VisualBench() { 67 VisualBench::~VisualBench() {
68 INHERITED::detach(); 68 INHERITED::detach();
69 } 69 }
70 70
71 void VisualBench::setTitle() { 71 void VisualBench::setTitle() {
72 SkString title("VisualBench"); 72 SkString title("VisualBench");
73 INHERITED::setTitle(title.c_str()); 73 INHERITED::setTitle(title.c_str());
74 } 74 }
75 75
76 SkSurface* VisualBench::createSurface() { 76 SkSurface* VisualBench::createSurface() {
77 SkSurfaceProps props(INHERITED::getSurfaceProps()); 77 if (!fSurface) {
78 return SkSurface::NewRenderTargetDirect(fRenderTarget, &props); 78 SkSurfaceProps props(INHERITED::getSurfaceProps());
79 fSurface.reset(SkSurface::NewRenderTargetDirect(fRenderTarget, &props));
80 }
81
82 // The caller will wrap the SkSurface in an SkAutoTUnref
83 return SkRef(fSurface.get());
79 } 84 }
80 85
81 bool VisualBench::setupBackend() { 86 bool VisualBench::setupBackend() {
82 this->setColorType(kRGBA_8888_SkColorType); 87 this->setColorType(kRGBA_8888_SkColorType);
83 this->setVisibleP(true); 88 this->setVisibleP(true);
84 this->setClipToBounds(false); 89 this->setClipToBounds(false);
85 90
86 if (FLAGS_fullscreen) { 91 if (FLAGS_fullscreen) {
87 if (!this->makeFullscreen()) { 92 if (!this->makeFullscreen()) {
88 SkDebugf("Could not go fullscreen!"); 93 SkDebugf("Could not go fullscreen!");
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 273
269 void application_term() { 274 void application_term() {
270 SkEvent::Term(); 275 SkEvent::Term();
271 SkGraphics::Term(); 276 SkGraphics::Term();
272 } 277 }
273 278
274 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) { 279 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) {
275 return new VisualBench(hwnd, argc, argv); 280 return new VisualBench(hwnd, argc, argv);
276 } 281 }
277 282
OLDNEW
« 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