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

Unified 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: SkMutex 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 side-by-side diff with in-line comments
Download patch
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..7ffba3080a9644b9125fb5bae3e08dd47f2dd1cc 100644
--- a/tools/viewer/sk_app/android/surface_glue_android.h
+++ b/tools/viewer/sk_app/android/surface_glue_android.h
@@ -12,6 +12,7 @@
#include <android/native_window_jni.h>
+#include "../private/SkMutex.h"
#include "../Application.h"
#include "../Window.h"
@@ -24,13 +25,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 +53,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 +65,9 @@ private:
JNIEnv* fPThreadEnv;
jmethodID fSetTitleMethodID;
+ bool fIsContentInvalidated = false; // use this to avoid duplicate invalidate events
+ SkMutex fMutex;
+
// This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive
~SkiaAndroidApp();
« 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