| Index: tools/viewer/sk_app/android/Window_android.cpp
|
| diff --git a/tools/viewer/sk_app/android/Window_android.cpp b/tools/viewer/sk_app/android/Window_android.cpp
|
| index 94be02c9336acc1493834c06918dad40ada2bfa7..b565375ac14ef4c5f4dd4e36bd0e751fd3f87b76 100644
|
| --- a/tools/viewer/sk_app/android/Window_android.cpp
|
| +++ b/tools/viewer/sk_app/android/Window_android.cpp
|
| @@ -13,7 +13,7 @@ namespace sk_app {
|
|
|
| Window* Window::CreateNativeWindow(void* platformData) {
|
| Window_android* window = new Window_android();
|
| - if (!window->init((android_app*)platformData)) {
|
| + if (!window->init((AppThread*)platformData)) {
|
| delete window;
|
| return nullptr;
|
| }
|
| @@ -23,6 +23,13 @@ Window* Window::CreateNativeWindow(void* platformData) {
|
| static void handle_cmd(struct android_app* app, int32_t cmd);
|
| static int32_t handle_input(struct android_app* app, AInputEvent* event);
|
|
|
| +bool Window_android::init(AppThread* appThread) {
|
| + SkASSERT(appThread);
|
| + mAppThread = appThread;
|
| + mAppThread->window = this;
|
| + return true;
|
| +}
|
| +
|
| bool Window_android::init(android_app* app) {
|
| SkASSERT(app);
|
| mApp = app;
|
| @@ -54,6 +61,7 @@ void Window_android::initDisplay(ANativeWindow* window) {
|
| ContextPlatformData_android platformData;
|
| platformData.fNativeWindow = window;
|
| fWindowContext = VulkanWindowContext::Create((void*)&platformData, mSampleCount);
|
| + nativeWindowInitialized = true;
|
| }
|
|
|
| static void android_app_write_cmd(struct android_app* android_app, int8_t cmd) {
|
| @@ -63,11 +71,15 @@ static void android_app_write_cmd(struct android_app* android_app, int8_t cmd) {
|
| }
|
|
|
| void Window_android::inval() {
|
| - android_app_write_cmd(mApp, APP_CMD_INVAL_WINDOW);
|
| + if (mApp) {
|
| + android_app_write_cmd(mApp, APP_CMD_INVAL_WINDOW);
|
| + } else {
|
| + paintIfNeeded();
|
| + }
|
| }
|
|
|
| void Window_android::paintIfNeeded() {
|
| - if (mApp->window || !mContentRect.isEmpty()) {
|
| + if ((mApp && (mApp->window || !mContentRect.isEmpty())) || nativeWindowInitialized) {
|
| this->onPaint();
|
| }
|
| }
|
|
|