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 |