Chromium Code Reviews| Index: tools/viewer/sk_app/android/GLWindowContext_android.cpp |
| diff --git a/tools/viewer/sk_app/android/GLWindowContext_android.cpp b/tools/viewer/sk_app/android/GLWindowContext_android.cpp |
| index a98b5553f848c9206e1f11fbfd8f13e329819b15..379393c39b1b22974dabfb59f0283d9d9081d026 100644 |
| --- a/tools/viewer/sk_app/android/GLWindowContext_android.cpp |
| +++ b/tools/viewer/sk_app/android/GLWindowContext_android.cpp |
| @@ -10,8 +10,6 @@ |
| #include "GLWindowContext_android.h" |
| -#include <android/native_window_jni.h> |
|
djsollen
2016/06/09 18:34:21
add this back since you can remove it from the hea
|
| - |
| namespace sk_app { |
| // Most of the following 3 functions (GLWindowContext::Create, constructor, desctructor) |
| @@ -43,11 +41,17 @@ GLWindowContext_android::~GLWindowContext_android() { |
| } |
| void GLWindowContext_android::onInitializeContext(void* platformData, const DisplayParams& params) { |
| - ContextPlatformData_android* androidPlatformData = |
| - reinterpret_cast<ContextPlatformData_android*>(platformData); |
| + if (platformData != nullptr) { |
| + ContextPlatformData_android* androidPlatformData = |
| + reinterpret_cast<ContextPlatformData_android*>(platformData); |
| + fNativeWindow = androidPlatformData->fNativeWindow; |
| + } else { |
| + SkASSERT(fNativeWindow); |
| + } |
| + |
| - fWidth = ANativeWindow_getWidth(androidPlatformData->fNativeWindow); |
| - fHeight = ANativeWindow_getHeight(androidPlatformData->fNativeWindow); |
| + fWidth = ANativeWindow_getWidth(fNativeWindow); |
| + fHeight = ANativeWindow_getHeight(fNativeWindow); |
| fDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); |
| @@ -81,7 +85,7 @@ void GLWindowContext_android::onInitializeContext(void* platformData, const Disp |
| SkASSERT(EGL_NO_CONTEXT != fEGLContext); |
| fSurface = eglCreateWindowSurface( |
| - fDisplay, surfaceConfig, androidPlatformData->fNativeWindow, nullptr); |
| + fDisplay, surfaceConfig, fNativeWindow, nullptr); |
| SkASSERT(EGL_NO_SURFACE != fSurface); |
| SkAssertResult(eglMakeCurrent(fDisplay, fSurface, fSurface, fEGLContext)); |