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

Side by Side Diff: tools/viewer/sk_app/android/surface_glue_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 unified diff | Download patch
« no previous file with comments | « tools/viewer/sk_app/android/RasterWindowContext_android.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/android/RasterWindowContext_android.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698