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

Unified Diff: tools/viewer/sk_app/android/surface_glue_android.h

Issue 1952323004: Initial commit of our new Android app to demo Skia. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clang 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
new file mode 100644
index 0000000000000000000000000000000000000000..85c4cc11c73c910ea0d7ce69aec3f40207076e75
--- /dev/null
+++ b/tools/viewer/sk_app/android/surface_glue_android.h
@@ -0,0 +1,47 @@
+/*
+* Copyright 2016 Google Inc.
+*
+* Use of this source code is governed by a BSD-style license that can be
+* found in the LICENSE file.
+*/
+
+#ifndef surface_glue_android_DEFINED
+#define surface_glue_android_DEFINED
+
+#include <pthread.h>
+
+#include <android/native_window_jni.h>
+
+#include "../Application.h"
+#include "../Window.h"
+
+namespace sk_app {
+
+enum MessageType { kUndefined, kSurfaceCreated, kSurfaceChanged, kSurfaceDestroyed, kDestroyApp };
djsollen 2016/05/09 13:17:14 you'll need to add something like... kContentInval
liyuqian 2016/05/09 14:27:27 Done.
+
+struct Message {
+ MessageType fType = kUndefined;
+ ANativeWindow* fNativeWindow = nullptr;
+
+ Message() {}
+ Message(MessageType t) : fType(t) {}
+};
+
+struct SkiaAndroidApp {
+ int fPipes[2]; // 0 is the read message pipe, 1 is the write message pipe
+ Application* fApp;
+ Window* fWindow;
+ ANativeWindow* fNativeWindow;
+
+ SkiaAndroidApp();
+ ~SkiaAndroidApp();
+ void postMessage(const Message& message);
+ 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.
+
+private:
+ pthread_t fThread;
+};
+
+} // namespace sk_app
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698