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 #include "SkOSWindow_Android.h" | 8 #include "SkOSWindow_Android.h" |
9 | 9 |
10 #include <GLES/gl.h> | 10 #include <GLES/gl.h> |
11 | 11 |
12 SkOSWindow::SkOSWindow(void* hwnd) { | 12 SkOSWindow::SkOSWindow(void* hwnd) { |
13 fWindow.fDisplay = EGL_NO_DISPLAY; | 13 fWindow.fDisplay = EGL_NO_DISPLAY; |
14 fWindow.fContext = EGL_NO_CONTEXT; | 14 fWindow.fContext = EGL_NO_CONTEXT; |
15 fWindow.fSurface = EGL_NO_SURFACE; | 15 fWindow.fSurface = EGL_NO_SURFACE; |
16 fNativeWindow = (ANativeWindow*)hwnd; | 16 fNativeWindow = (ANativeWindow*)hwnd; |
17 fDestroyRequested = false; | 17 fDestroyRequested = false; |
18 } | 18 } |
19 | 19 |
20 SkOSWindow::~SkOSWindow() { | 20 SkOSWindow::~SkOSWindow() { |
21 this->detach(); | 21 this->release(); |
22 } | 22 } |
23 | 23 |
24 bool SkOSWindow::attach(SkBackEndTypes attachType, | 24 bool SkOSWindow::attach(SkBackEndTypes attachType, |
25 int /*msaaSampleCount*/, | 25 int /*msaaSampleCount*/, |
26 AttachmentInfo* info) { | 26 AttachmentInfo* info) { |
27 static const EGLint kEGLContextAttribsForOpenGL[] = { | 27 static const EGLint kEGLContextAttribsForOpenGL[] = { |
28 EGL_NONE | 28 EGL_NONE |
29 }; | 29 }; |
30 | 30 |
31 static const EGLint kEGLContextAttribsForOpenGLES[] = { | 31 static const EGLint kEGLContextAttribsForOpenGLES[] = { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 142 glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
143 | 143 |
144 // We retrieve the fullscreen width and height | 144 // We retrieve the fullscreen width and height |
145 this->setSize((SkScalar)w, (SkScalar)h); | 145 this->setSize((SkScalar)w, (SkScalar)h); |
146 return true; | 146 return true; |
147 } else { | 147 } else { |
148 return false; | 148 return false; |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 void SkOSWindow::detach() { | 152 void SkOSWindow::release() { |
153 if (fWindow.fDisplay != EGL_NO_DISPLAY) { | 153 if (fWindow.fDisplay != EGL_NO_DISPLAY) { |
154 eglMakeCurrent(fWindow.fDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_
CONTEXT); | 154 eglMakeCurrent(fWindow.fDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_
CONTEXT); |
155 if (fWindow.fContext != EGL_NO_CONTEXT) { | 155 if (fWindow.fContext != EGL_NO_CONTEXT) { |
156 eglDestroyContext(fWindow.fDisplay, fWindow.fContext); | 156 eglDestroyContext(fWindow.fDisplay, fWindow.fContext); |
157 } | 157 } |
158 if (fWindow.fSurface != EGL_NO_SURFACE) { | 158 if (fWindow.fSurface != EGL_NO_SURFACE) { |
159 eglDestroySurface(fWindow.fDisplay, fWindow.fSurface); | 159 eglDestroySurface(fWindow.fDisplay, fWindow.fSurface); |
160 } | 160 } |
161 eglTerminate(fWindow.fDisplay); | 161 eglTerminate(fWindow.fDisplay); |
162 } | 162 } |
(...skipping 27 matching lines...) Expand all Loading... |
190 | 190 |
191 /////////////////////////////////////////// | 191 /////////////////////////////////////////// |
192 /////////////// SkEvent impl ////////////// | 192 /////////////// SkEvent impl ////////////// |
193 /////////////////////////////////////////// | 193 /////////////////////////////////////////// |
194 | 194 |
195 void SkEvent::SignalQueueTimer(SkMSec ms) { | 195 void SkEvent::SignalQueueTimer(SkMSec ms) { |
196 } | 196 } |
197 | 197 |
198 void SkEvent::SignalNonEmptyQueue() { | 198 void SkEvent::SignalNonEmptyQueue() { |
199 } | 199 } |
OLD | NEW |