OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "surface_glue_android.h" | 8 #include "surface_glue_android.h" |
9 | 9 |
10 #include <jni.h> | 10 #include <jni.h> |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 SkASSERT(message.fNativeWindow); | 117 SkASSERT(message.fNativeWindow); |
118 int width = ANativeWindow_getWidth(skiaAndroidApp->fNativeWindow); | 118 int width = ANativeWindow_getWidth(skiaAndroidApp->fNativeWindow); |
119 int height = ANativeWindow_getHeight(skiaAndroidApp->fNativeWindow); | 119 int height = ANativeWindow_getHeight(skiaAndroidApp->fNativeWindow); |
120 auto window_android = (Window_android*)skiaAndroidApp->fWindow; | 120 auto window_android = (Window_android*)skiaAndroidApp->fWindow; |
121 if (message.fNativeWindow != skiaAndroidApp->fNativeWindow) { | 121 if (message.fNativeWindow != skiaAndroidApp->fNativeWindow) { |
122 window_android->onDisplayDestroyed(); | 122 window_android->onDisplayDestroyed(); |
123 ANativeWindow_release(skiaAndroidApp->fNativeWindow); | 123 ANativeWindow_release(skiaAndroidApp->fNativeWindow); |
124 skiaAndroidApp->fNativeWindow = message.fNativeWindow; | 124 skiaAndroidApp->fNativeWindow = message.fNativeWindow; |
125 window_android->initDisplay(skiaAndroidApp->fNativeWindow); | 125 window_android->initDisplay(skiaAndroidApp->fNativeWindow); |
126 } | 126 } |
| 127 window_android->onResize(width, height); |
127 window_android->setContentRect(0, 0, width, height); | 128 window_android->setContentRect(0, 0, width, height); |
128 window_android->paintIfNeeded(); | 129 window_android->paintIfNeeded(); |
129 break; | 130 break; |
130 } | 131 } |
131 case kSurfaceDestroyed: { | 132 case kSurfaceDestroyed: { |
132 if (skiaAndroidApp->fNativeWindow) { | 133 if (skiaAndroidApp->fNativeWindow) { |
133 auto window_android = (Window_android*)skiaAndroidApp->fWindow; | 134 auto window_android = (Window_android*)skiaAndroidApp->fWindow; |
134 window_android->onDisplayDestroyed(); | 135 window_android->onDisplayDestroyed(); |
135 ANativeWindow_release(skiaAndroidApp->fNativeWindow); | 136 ANativeWindow_release(skiaAndroidApp->fNativeWindow); |
136 skiaAndroidApp->fNativeWindow = nullptr; | 137 skiaAndroidApp->fNativeWindow = nullptr; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 const char* nameChars = env->GetStringUTFChars(stateName, nullptr); | 266 const char* nameChars = env->GetStringUTFChars(stateName, nullptr); |
266 const char* valueChars = env->GetStringUTFChars(stateValue, nullptr); | 267 const char* valueChars = env->GetStringUTFChars(stateValue, nullptr); |
267 message.stateName = new SkString(nameChars); | 268 message.stateName = new SkString(nameChars); |
268 message.stateValue = new SkString(valueChars); | 269 message.stateValue = new SkString(valueChars); |
269 skiaAndroidApp->postMessage(message); | 270 skiaAndroidApp->postMessage(message); |
270 env->ReleaseStringUTFChars(stateName, nameChars); | 271 env->ReleaseStringUTFChars(stateName, nameChars); |
271 env->ReleaseStringUTFChars(stateValue, valueChars); | 272 env->ReleaseStringUTFChars(stateValue, valueChars); |
272 } | 273 } |
273 | 274 |
274 } // namespace sk_app | 275 } // namespace sk_app |
OLD | NEW |