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

Unified Diff: tools/vulkan/Window.cpp

Issue 1865553005: Clean up input handling in VulkanViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rename resize params Created 4 years, 8 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
« no previous file with comments | « tools/vulkan/Window.h ('k') | tools/vulkan/viewer/InputHandler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/vulkan/Window.cpp
diff --git a/tools/vulkan/Window.cpp b/tools/vulkan/Window.cpp
index d0a2a76abcb0f42e4f377d280d57f122a853fd0a..86f181496da42cd9488a0af441055ac49367475a 100644
--- a/tools/vulkan/Window.cpp
+++ b/tools/vulkan/Window.cpp
@@ -11,17 +11,24 @@
#include "SkCanvas.h"
#include "VulkanTestContext.h"
-static bool default_key_func(int key, bool down, void* userData) {
+static bool default_char_func(SkUnichar c, uint32_t modifiers, void* userData) {
return false;
}
-static bool default_mouse_func(int x, int y, bool down, void* userData) {
+static bool default_key_func(Window::Key key, Window::InputState state, uint32_t modifiers,
+ void* userData) {
+ return false;
+}
+
+static bool default_mouse_func(int x, int y, Window::InputState state, uint32_t modifiers,
+ void* userData) {
return false;
}
static void default_paint_func(SkCanvas*, void* userData) {}
-Window::Window() : fKeyFunc(default_key_func)
+Window::Window() : fCharFunc(default_char_func)
+ , fKeyFunc(default_key_func)
, fMouseFunc(default_mouse_func)
, fPaintFunc(default_paint_func) {
}
@@ -31,6 +38,18 @@ void Window::detach() {
fTestContext = nullptr;
}
+bool Window::onChar(SkUnichar c, uint32_t modifiers) {
+ return fCharFunc(c, modifiers, fCharUserData);
+}
+
+bool Window::onKey(Key key, InputState state, uint32_t modifiers) {
+ return fKeyFunc(key, state, modifiers, fKeyUserData);
+}
+
+bool Window::onMouse(int x, int y, InputState state, uint32_t modifiers) {
+ return fMouseFunc(x, y, state, modifiers, fMouseUserData);
+}
+
void Window::onPaint() {
SkSurface* backbuffer = fTestContext->getBackbufferSurface();
if (backbuffer) {
@@ -47,6 +66,6 @@ void Window::onPaint() {
}
-void Window::onSize() {
- fTestContext->resize();
+void Window::onResize(uint32_t w, uint32_t h) {
+ fTestContext->resize(w, h);
}
« no previous file with comments | « tools/vulkan/Window.h ('k') | tools/vulkan/viewer/InputHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698