Chromium Code Reviews| Index: tools/viewer/sk_app/android/surface_glue_android.h |
| diff --git a/tools/viewer/sk_app/android/surface_glue_android.h b/tools/viewer/sk_app/android/surface_glue_android.h |
| index 1ce06674b9eead2ac60d6f13a5f8517f0d4797fe..651e28daf4bbae4fbcebde89f61bbf126ebb1898 100644 |
| --- a/tools/viewer/sk_app/android/surface_glue_android.h |
| +++ b/tools/viewer/sk_app/android/surface_glue_android.h |
| @@ -24,13 +24,16 @@ enum MessageType { |
| kSurfaceDestroyed, |
| kDestroyApp, |
| kContentInvalidated, |
| - kKeyPressed |
| + kKeyPressed, |
| + kTouched |
| }; |
| struct Message { |
| MessageType fType = kUndefined; |
| ANativeWindow* fNativeWindow = nullptr; |
| - int keycode = 0; |
| + int fKeycode = 0; |
| + int fTouchOwner, fTouchState; |
| + float fTouchX, fTouchY; |
| Message() {} |
| Message(MessageType t) : fType(t) {} |
| @@ -49,6 +52,10 @@ struct SkiaAndroidApp { |
| // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive |
| void setTitle(const char* title) const; |
| + |
| + // This posts a kContentInvalidated message if there's no such message currently in the queue |
| + void inval(); |
| + |
| private: |
| pthread_t fThread; |
| ANativeWindow* fNativeWindow; |
| @@ -57,6 +64,9 @@ private: |
| JNIEnv* fPThreadEnv; |
| jmethodID fSetTitleMethodID; |
| + bool fIsContentInvalidated = false; // use this to avoid duplicate invalidate events |
| + pthread_mutex_t fMutex; |
|
djsollen
2016/05/17 18:48:03
use SkMutex as it will handle the create and destr
liyuqian
2016/05/17 19:06:35
Done.
|
| + |
| // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive |
| ~SkiaAndroidApp(); |