aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/viewer
diff options
context:
space:
mode:
authorGravatar liyuqian <liyuqian@google.com>2016-08-22 11:31:09 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-22 11:31:09 -0700
commit23d24587ee4907ebb8136abe177721ca51b5a89a (patch)
treec07c7a9c68143592a400afcf757f7e572d40a60a /tools/viewer
parent7b145120f2387aeb69fdcf444aa406c70075de27 (diff)
Fix touch event parameter order
The issue is so obvious... However, all newer Android devices (e.g., Nexus 6P, 5X, 9) are immune to this bug. So I didn't notice this until I tested Viewer app on Nexus 7 yesterday... BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2254223002 Review-Url: https://codereview.chromium.org/2254223002
Diffstat (limited to 'tools/viewer')
-rw-r--r--tools/viewer/sk_app/android/surface_glue_android.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/viewer/sk_app/android/surface_glue_android.cpp b/tools/viewer/sk_app/android/surface_glue_android.cpp
index d001cd5367..29d9ff089c 100644
--- a/tools/viewer/sk_app/android/surface_glue_android.cpp
+++ b/tools/viewer/sk_app/android/surface_glue_android.cpp
@@ -147,9 +147,12 @@ int SkiaAndroidApp::message_callback(int fd, int events, void* data) {
}
case kTouched: {
auto it = ANDROID_TO_WINDOW_STATEMAP.find(message.fTouchState);
- SkASSERT(it != ANDROID_TO_WINDOW_STATEMAP.end());
- skiaAndroidApp->fWindow->onTouch(message.fTouchOwner, it->second, message.fTouchX,
- message.fTouchY);
+ if (it != ANDROID_TO_WINDOW_STATEMAP.end()) {
+ skiaAndroidApp->fWindow->onTouch(message.fTouchOwner, it->second, message.fTouchX,
+ message.fTouchY);
+ } else {
+ SkDebugf("Unknown Touch State: %d\n", message.fTouchState);
+ }
break;
}
case kUIStateChanged: {
@@ -242,7 +245,7 @@ extern "C" JNIEXPORT void JNICALL Java_org_skia_viewer_ViewerActivity_onKeyPress
}
extern "C" JNIEXPORT void JNICALL Java_org_skia_viewer_ViewerActivity_onTouched(
- JNIEnv* env, jobject activity, jlong handle, jint owner, jfloat x, jfloat y, jint state) {
+ JNIEnv* env, jobject activity, jlong handle, jint owner, jint state, jfloat x, jfloat y) {
auto skiaAndroidApp = (SkiaAndroidApp*)handle;
Message message(kTouched);
message.fTouchOwner = owner;