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

Side by Side Diff: tools/viewer/sk_app/android/surface_glue_android.cpp

Issue 2254223002: Fix touch event parameter order (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 case kKeyPressed: { 140 case kKeyPressed: {
141 auto it = ANDROID_TO_WINDOW_KEYMAP.find(message.fKeycode); 141 auto it = ANDROID_TO_WINDOW_KEYMAP.find(message.fKeycode);
142 SkASSERT(it != ANDROID_TO_WINDOW_KEYMAP.end()); 142 SkASSERT(it != ANDROID_TO_WINDOW_KEYMAP.end());
143 // No modifier is supported so far 143 // No modifier is supported so far
144 skiaAndroidApp->fWindow->onKey(it->second, Window::kDown_InputState, 0); 144 skiaAndroidApp->fWindow->onKey(it->second, Window::kDown_InputState, 0);
145 skiaAndroidApp->fWindow->onKey(it->second, Window::kUp_InputState, 0 ); 145 skiaAndroidApp->fWindow->onKey(it->second, Window::kUp_InputState, 0 );
146 break; 146 break;
147 } 147 }
148 case kTouched: { 148 case kTouched: {
149 auto it = ANDROID_TO_WINDOW_STATEMAP.find(message.fTouchState); 149 auto it = ANDROID_TO_WINDOW_STATEMAP.find(message.fTouchState);
150 SkASSERT(it != ANDROID_TO_WINDOW_STATEMAP.end()); 150 if (it != ANDROID_TO_WINDOW_STATEMAP.end()) {
151 skiaAndroidApp->fWindow->onTouch(message.fTouchOwner, it->second, me ssage.fTouchX, 151 skiaAndroidApp->fWindow->onTouch(message.fTouchOwner, it->second , message.fTouchX,
152 message.fTouchY); 152 message.fTouchY);
153 } else {
154 SkDebugf("Unknown Touch State: %d\n", message.fTouchState);
155 }
153 break; 156 break;
154 } 157 }
155 case kUIStateChanged: { 158 case kUIStateChanged: {
156 skiaAndroidApp->fWindow->onUIStateChanged(*message.stateName, *messa ge.stateValue); 159 skiaAndroidApp->fWindow->onUIStateChanged(*message.stateName, *messa ge.stateValue);
157 delete message.stateName; 160 delete message.stateName;
158 delete message.stateValue; 161 delete message.stateValue;
159 break; 162 break;
160 } 163 }
161 default: { 164 default: {
162 // do nothing 165 // do nothing
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 jobject activity, 238 jobject activity,
236 jlong handle, 239 jlong handle,
237 jint keycode) { 240 jint keycode) {
238 auto skiaAndroidApp = (SkiaAndroidApp*)handle; 241 auto skiaAndroidApp = (SkiaAndroidApp*)handle;
239 Message message(kKeyPressed); 242 Message message(kKeyPressed);
240 message.fKeycode = keycode; 243 message.fKeycode = keycode;
241 skiaAndroidApp->postMessage(message); 244 skiaAndroidApp->postMessage(message);
242 } 245 }
243 246
244 extern "C" JNIEXPORT void JNICALL Java_org_skia_viewer_ViewerActivity_onTouched( 247 extern "C" JNIEXPORT void JNICALL Java_org_skia_viewer_ViewerActivity_onTouched(
245 JNIEnv* env, jobject activity, jlong handle, jint owner, jfloat x, jfloat y, jint state) { 248 JNIEnv* env, jobject activity, jlong handle, jint owner, jint state, jfloat x, jfloat y) {
246 auto skiaAndroidApp = (SkiaAndroidApp*)handle; 249 auto skiaAndroidApp = (SkiaAndroidApp*)handle;
247 Message message(kTouched); 250 Message message(kTouched);
248 message.fTouchOwner = owner; 251 message.fTouchOwner = owner;
249 message.fTouchState = state; 252 message.fTouchState = state;
250 message.fTouchX = x; 253 message.fTouchX = x;
251 message.fTouchY = y; 254 message.fTouchY = y;
252 skiaAndroidApp->postMessage(message); 255 skiaAndroidApp->postMessage(message);
253 } 256 }
254 257
255 extern "C" JNIEXPORT void JNICALL Java_org_skia_viewer_ViewerActivity_onUIStateC hanged( 258 extern "C" JNIEXPORT void JNICALL Java_org_skia_viewer_ViewerActivity_onUIStateC hanged(
256 JNIEnv* env, jobject activity, jlong handle, jstring stateName, jstring stat eValue) { 259 JNIEnv* env, jobject activity, jlong handle, jstring stateName, jstring stat eValue) {
257 auto skiaAndroidApp = (SkiaAndroidApp*)handle; 260 auto skiaAndroidApp = (SkiaAndroidApp*)handle;
258 Message message(kUIStateChanged); 261 Message message(kUIStateChanged);
259 const char* nameChars = env->GetStringUTFChars(stateName, nullptr); 262 const char* nameChars = env->GetStringUTFChars(stateName, nullptr);
260 const char* valueChars = env->GetStringUTFChars(stateValue, nullptr); 263 const char* valueChars = env->GetStringUTFChars(stateValue, nullptr);
261 message.stateName = new SkString(nameChars); 264 message.stateName = new SkString(nameChars);
262 message.stateValue = new SkString(valueChars); 265 message.stateValue = new SkString(valueChars);
263 skiaAndroidApp->postMessage(message); 266 skiaAndroidApp->postMessage(message);
264 env->ReleaseStringUTFChars(stateName, nameChars); 267 env->ReleaseStringUTFChars(stateName, nameChars);
265 env->ReleaseStringUTFChars(stateValue, valueChars); 268 env->ReleaseStringUTFChars(stateValue, valueChars);
266 } 269 }
267 270
268 } // namespace sk_app 271 } // namespace sk_app
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698