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

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

Issue 1965013007: Use swipe gesture to switch between slides on Android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Revision 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 }; 28 };
28 29
29 struct Message { 30 struct Message {
30 MessageType fType = kUndefined; 31 MessageType fType = kUndefined;
31 ANativeWindow* fNativeWindow = nullptr; 32 ANativeWindow* fNativeWindow = nullptr;
33 int keycode = 0;
32 34
33 Message() {} 35 Message() {}
34 Message(MessageType t) : fType(t) {} 36 Message(MessageType t) : fType(t) {}
35 }; 37 };
36 38
37 struct SkiaAndroidApp { 39 struct SkiaAndroidApp {
38 int fPipes[2]; // 0 is the read message pipe, 1 is the write message pipe 40 int fPipes[2]; // 0 is the read message pipe, 1 is the write message pipe
39 Application* fApp; 41 Application* fApp;
40 Window* fWindow; 42 Window* fWindow;
41 ANativeWindow* fNativeWindow; 43 ANativeWindow* fNativeWindow;
42 44
43 SkiaAndroidApp(); 45 SkiaAndroidApp();
44 ~SkiaAndroidApp(); 46 ~SkiaAndroidApp();
45 void postMessage(const Message& message); 47 void postMessage(const Message& message);
46 void readMessage(Message* message); 48 void readMessage(Message* message);
47 void paintIfNeeded(); 49 void paintIfNeeded();
48 50
49 private: 51 private:
50 pthread_t fThread; 52 pthread_t fThread;
51 }; 53 };
52 54
53 } // namespace sk_app 55 } // namespace sk_app
54 56
55 #endif 57 #endif
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/android/Window_android.cpp ('k') | tools/viewer/sk_app/android/surface_glue_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698