Index: tools/viewer/sk_app/android/surface_glue_android.cpp |
diff --git a/tools/viewer/sk_app/android/surface_glue_android.cpp b/tools/viewer/sk_app/android/surface_glue_android.cpp |
index 1821a53efe3a25d1b073b65bf012fafa0bebc4f2..895b0bc4596bad4cd7607dbf7914e3f47c120145 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; |