OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2016 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef surface_glue_android_DEFINED | |
9 #define surface_glue_android_DEFINED | |
10 | |
11 #include <pthread.h> | |
12 | |
13 #include <android/native_window_jni.h> | |
14 | |
15 #include "../Application.h" | |
16 #include "../Window.h" | |
17 | |
18 namespace sk_app { | |
19 | |
20 enum MessageType { kUndefined, kSurfaceCreated, kSurfaceChanged, kSurfaceDestroy ed, kDestroyApp }; | |
djsollen
2016/05/09 13:17:14
you'll need to add something like... kContentInval
liyuqian
2016/05/09 14:27:27
Done.
| |
21 | |
22 struct Message { | |
23 MessageType fType = kUndefined; | |
24 ANativeWindow* fNativeWindow = nullptr; | |
25 | |
26 Message() {} | |
27 Message(MessageType t) : fType(t) {} | |
28 }; | |
29 | |
30 struct SkiaAndroidApp { | |
31 int fPipes[2]; // 0 is the read message pipe, 1 is the write message pipe | |
32 Application* fApp; | |
33 Window* fWindow; | |
34 ANativeWindow* fNativeWindow; | |
35 | |
36 SkiaAndroidApp(); | |
37 ~SkiaAndroidApp(); | |
38 void postMessage(const Message& message); | |
39 void readMessage(Message* message); | |
djsollen
2016/05/09 13:17:14
add method paintIfNeeded() that checks to make sur
liyuqian
2016/05/09 14:27:28
Done.
| |
40 | |
41 private: | |
42 pthread_t fThread; | |
43 }; | |
44 | |
45 } // namespace sk_app | |
46 | |
47 #endif | |
OLD | NEW |