OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |