| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 * | 7 * |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 #include "HelloWorld.h" | 10 #include "HelloWorld.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 void HelloWorldWindow::tearDownBackend() { | 42 void HelloWorldWindow::tearDownBackend() { |
| 43 SkSafeUnref(fContext); | 43 SkSafeUnref(fContext); |
| 44 fContext = NULL; | 44 fContext = NULL; |
| 45 | 45 |
| 46 SkSafeUnref(fInterface); | 46 SkSafeUnref(fInterface); |
| 47 fInterface = NULL; | 47 fInterface = NULL; |
| 48 | 48 |
| 49 SkSafeUnref(fRenderTarget); | 49 SkSafeUnref(fRenderTarget); |
| 50 fRenderTarget = NULL; | 50 fRenderTarget = NULL; |
| 51 | 51 |
| 52 INHERITED::detach(); | 52 INHERITED::release(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void HelloWorldWindow::setTitle() { | 55 void HelloWorldWindow::setTitle() { |
| 56 SkString title("Hello World "); | 56 SkString title("Hello World "); |
| 57 title.appendf(fType == kRaster_DeviceType ? "raster" : "opengl"); | 57 title.appendf(fType == kRaster_DeviceType ? "raster" : "opengl"); |
| 58 INHERITED::setTitle(title.c_str()); | 58 INHERITED::setTitle(title.c_str()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool HelloWorldWindow::setUpBackend() { | 61 bool HelloWorldWindow::setUpBackend() { |
| 62 this->setVisibleP(true); | 62 this->setVisibleP(true); |
| 63 this->setClipToBounds(false); | 63 this->setClipToBounds(false); |
| 64 | 64 |
| 65 bool result = attach(kNativeGL_BackEndType, 0 /*msaa*/, &fAttachmentInfo); | 65 bool result = attach(kNativeGL_BackEndType, 0 /*msaa*/, &fAttachmentInfo); |
| 66 if (false == result) { | 66 if (false == result) { |
| 67 SkDebugf("Not possible to create backend.\n"); | 67 SkDebugf("Not possible to create backend.\n"); |
| 68 detach(); | 68 release(); |
| 69 return false; | 69 return false; |
| 70 } | 70 } |
| 71 | 71 |
| 72 fInterface = GrGLCreateNativeInterface(); | 72 fInterface = GrGLCreateNativeInterface(); |
| 73 | 73 |
| 74 SkASSERT(NULL != fInterface); | 74 SkASSERT(NULL != fInterface); |
| 75 | 75 |
| 76 fContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)fInterface
); | 76 fContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)fInterface
); |
| 77 SkASSERT(NULL != fContext); | 77 SkASSERT(NULL != fContext); |
| 78 | 78 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 setUpBackend(); | 177 setUpBackend(); |
| 178 this->setTitle(); | 178 this->setTitle(); |
| 179 this->inval(NULL); | 179 this->inval(NULL); |
| 180 } | 180 } |
| 181 return true; | 181 return true; |
| 182 } | 182 } |
| 183 | 183 |
| 184 SkOSWindow* create_sk_window(void* hwnd, int , char** ) { | 184 SkOSWindow* create_sk_window(void* hwnd, int , char** ) { |
| 185 return new HelloWorldWindow(hwnd); | 185 return new HelloWorldWindow(hwnd); |
| 186 } | 186 } |
| OLD | NEW |