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

Unified Diff: tools/viewer/sk_app/Window.cpp

Issue 1982643004: Implement touch control (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Dedup 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/Window.cpp
diff --git a/tools/viewer/sk_app/Window.cpp b/tools/viewer/sk_app/Window.cpp
index 47053be5afc5a503f398316238bdda317fd94ead..8e8e5db9c490180919c4a17a42a28d883b3eb0df 100644
--- a/tools/viewer/sk_app/Window.cpp
+++ b/tools/viewer/sk_app/Window.cpp
@@ -52,6 +52,26 @@ bool Window::onMouse(int x, int y, InputState state, uint32_t modifiers) {
return fMouseFunc(x, y, state, modifiers, fMouseUserData);
}
+bool Window::onTouch(int owner, InputState state, float x, float y) {
djsollen 2016/05/17 12:40:25 seems odd to me that the window interprets touch a
+ void* castedOwner = reinterpret_cast<void*>(owner);
+ switch (state) {
+ case Window::kUp_InputState: {
+ fGesture.touchEnd(castedOwner);
+ break;
+ }
+ case Window::kDown_InputState: {
+ fGesture.touchBegin(castedOwner, x, y);
+ break;
+ }
+ case Window::kMove_InputState: {
+ fGesture.touchMoved(castedOwner, x, y);
+ break;
+ }
+ }
+ inval();
+ return true;
+}
+
void Window::onPaint() {
SkSurface* backbuffer = fWindowContext->getBackbufferSurface();
if (backbuffer) {
@@ -83,4 +103,8 @@ void Window::setDisplayParams(const DisplayParams& params) {
fWindowContext->setDisplayParams(params);
}
+const SkMatrix& Window::getGestureLocalM() { return fGesture.localM(); }
+
+const SkMatrix& Window::getGestureGlobalM() const { return fGesture.globalM(); }
+
} // namespace sk_app

Powered by Google App Engine
This is Rietveld 408576698