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

Side by Side Diff: samplecode/SampleApp.cpp

Issue 1809733002: detach -> release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 #include "SampleApp.h" 8 #include "SampleApp.h"
9 9
10 #include "OverView.h" 10 #include "OverView.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 fCurContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fC urIntf); 254 fCurContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fC urIntf);
255 255
256 if (nullptr == fCurContext || nullptr == fCurIntf) { 256 if (nullptr == fCurContext || nullptr == fCurIntf) {
257 // We need some context and interface to see results 257 // We need some context and interface to see results
258 SkSafeUnref(fCurContext); 258 SkSafeUnref(fCurContext);
259 SkSafeUnref(fCurIntf); 259 SkSafeUnref(fCurIntf);
260 fCurContext = nullptr; 260 fCurContext = nullptr;
261 fCurIntf = nullptr; 261 fCurIntf = nullptr;
262 SkDebugf("Failed to setup 3D"); 262 SkDebugf("Failed to setup 3D");
263 263
264 win->detach(); 264 win->release();
265 } 265 }
266 #endif // SK_SUPPORT_GPU 266 #endif // SK_SUPPORT_GPU
267 // call windowSizeChanged to create the render target 267 // call windowSizeChanged to create the render target
268 this->windowSizeChanged(win); 268 this->windowSizeChanged(win);
269 } 269 }
270 270
271 void tearDownBackend(SampleWindow *win) override { 271 void tearDownBackend(SampleWindow *win) override {
272 #if SK_SUPPORT_GPU 272 #if SK_SUPPORT_GPU
273 if (fCurContext) { 273 if (fCurContext) {
274 // in case we have outstanding refs to this guy (lua?) 274 // in case we have outstanding refs to this guy (lua?)
275 fCurContext->abandonContext(); 275 fCurContext->abandonContext();
276 fCurContext->unref(); 276 fCurContext->unref();
277 fCurContext = nullptr; 277 fCurContext = nullptr;
278 } 278 }
279 279
280 SkSafeUnref(fCurIntf); 280 SkSafeUnref(fCurIntf);
281 fCurIntf = nullptr; 281 fCurIntf = nullptr;
282 282
283 SkSafeUnref(fCurRenderTarget); 283 SkSafeUnref(fCurRenderTarget);
284 fCurRenderTarget = nullptr; 284 fCurRenderTarget = nullptr;
285 #endif 285 #endif
286 win->detach(); 286 win->release();
287 fBackend = kNone_BackEndType; 287 fBackend = kNone_BackEndType;
288 } 288 }
289 289
290 SkSurface* createSurface(SampleWindow::DeviceType dType, SampleWindow* win) override { 290 SkSurface* createSurface(SampleWindow::DeviceType dType, SampleWindow* win) override {
291 #if SK_SUPPORT_GPU 291 #if SK_SUPPORT_GPU
292 if (IsGpuDeviceType(dType) && fCurContext) { 292 if (IsGpuDeviceType(dType) && fCurContext) {
293 SkSurfaceProps props(win->getSurfaceProps()); 293 SkSurfaceProps props(win->getSurfaceProps());
294 return SkSurface::NewRenderTargetDirect(fCurRenderTarget, &props); 294 return SkSurface::NewRenderTargetDirect(fCurRenderTarget, &props);
295 } 295 }
296 #endif 296 #endif
(...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after
2329 #ifdef SK_BUILD_FOR_MAC 2329 #ifdef SK_BUILD_FOR_MAC
2330 setenv("ANDROID_ROOT", "/android/device/data", 0); 2330 setenv("ANDROID_ROOT", "/android/device/data", 0);
2331 #endif 2331 #endif
2332 SkGraphics::Init(); 2332 SkGraphics::Init();
2333 SkEvent::Init(); 2333 SkEvent::Init();
2334 } 2334 }
2335 2335
2336 void application_term() { 2336 void application_term() {
2337 SkEvent::Term(); 2337 SkEvent::Term();
2338 } 2338 }
OLDNEW
« no previous file with comments | « platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp ('k') | samplecode/SamplePictFile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698