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

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

Issue 1982643004: Implement touch control (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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
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 #ifndef surface_glue_android_DEFINED 8 #ifndef surface_glue_android_DEFINED
9 #define surface_glue_android_DEFINED 9 #define surface_glue_android_DEFINED
10 10
11 #include <pthread.h> 11 #include <pthread.h>
12 12
13 #include <android/native_window_jni.h> 13 #include <android/native_window_jni.h>
14 14
15 #include "../Application.h" 15 #include "../Application.h"
16 #include "../Window.h" 16 #include "../Window.h"
17 17
18 namespace sk_app { 18 namespace sk_app {
19 19
20 enum MessageType { 20 enum MessageType {
21 kUndefined, 21 kUndefined,
22 kSurfaceCreated, 22 kSurfaceCreated,
23 kSurfaceChanged, 23 kSurfaceChanged,
24 kSurfaceDestroyed, 24 kSurfaceDestroyed,
25 kDestroyApp, 25 kDestroyApp,
26 kContentInvalidated, 26 kContentInvalidated,
27 kKeyPressed 27 kKeyPressed,
28 kTouched
28 }; 29 };
29 30
30 struct Message { 31 struct Message {
31 MessageType fType = kUndefined; 32 MessageType fType = kUndefined;
32 ANativeWindow* fNativeWindow = nullptr; 33 ANativeWindow* fNativeWindow = nullptr;
33 int keycode = 0; 34 int fKeycode = 0;
35 int fTouchOwner, fTouchState;
36 float fTouchX, fTouchY;
34 37
35 Message() {} 38 Message() {}
36 Message(MessageType t) : fType(t) {} 39 Message(MessageType t) : fType(t) {}
37 }; 40 };
38 41
39 struct SkiaAndroidApp { 42 struct SkiaAndroidApp {
40 Application* fApp; 43 Application* fApp;
41 Window* fWindow; 44 Window* fWindow;
42 jobject fAndroidApp; 45 jobject fAndroidApp;
43 46
(...skipping 16 matching lines...) Expand all
60 // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive 63 // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive
61 ~SkiaAndroidApp(); 64 ~SkiaAndroidApp();
62 65
63 static int message_callback(int fd, int events, void* data); 66 static int message_callback(int fd, int events, void* data);
64 static void* pthread_main(void*); 67 static void* pthread_main(void*);
65 }; 68 };
66 69
67 } // namespace sk_app 70 } // namespace sk_app
68 71
69 #endif 72 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698