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

Unified Diff: tools/viewer/sk_app/android/GLWindowContext_android.cpp

Issue 2050613003: Support resize in Android Viewer App (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Nits Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
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));
« no previous file with comments | « tools/viewer/sk_app/android/GLWindowContext_android.h ('k') | tools/viewer/sk_app/android/RasterWindowContext_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698