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..0b3363354b5c235d1947b89f90426c2ec7b19094 100644 |
--- a/tools/viewer/sk_app/android/GLWindowContext_android.cpp |
+++ b/tools/viewer/sk_app/android/GLWindowContext_android.cpp |
@@ -43,11 +43,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 +87,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)); |