aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/viewer/sk_app/android/surface_glue_android.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/viewer/sk_app/android/surface_glue_android.cpp b/tools/viewer/sk_app/android/surface_glue_android.cpp
index 1821a53efe..895b0bc459 100644
--- a/tools/viewer/sk_app/android/surface_glue_android.cpp
+++ b/tools/viewer/sk_app/android/surface_glue_android.cpp
@@ -114,11 +114,16 @@ int SkiaAndroidApp::message_callback(int fd, int events, void* data) {
break;
}
case kSurfaceChanged: {
- SkASSERT(message.fNativeWindow == skiaAndroidApp->fNativeWindow &&
- message.fNativeWindow);
+ SkASSERT(message.fNativeWindow);
int width = ANativeWindow_getWidth(skiaAndroidApp->fNativeWindow);
int height = ANativeWindow_getHeight(skiaAndroidApp->fNativeWindow);
auto window_android = (Window_android*)skiaAndroidApp->fWindow;
+ if (message.fNativeWindow != skiaAndroidApp->fNativeWindow) {
+ window_android->onDisplayDestroyed();
+ ANativeWindow_release(skiaAndroidApp->fNativeWindow);
+ skiaAndroidApp->fNativeWindow = message.fNativeWindow;
+ window_android->initDisplay(skiaAndroidApp->fNativeWindow);
+ }
window_android->setContentRect(0, 0, width, height);
window_android->paintIfNeeded();
break;