sk_app, Sample: Unify InputState enum.
replace() {
if git grep -q "$1")";
then sed -i -e "s#${1}#${2}#g" $(git grep -l "$1");
fi
}
replace 'k\([A-Za-z]*\)_InputState' 'InputState::k\1'
replace '\(\(sk_app::\|\)Window\|Sample\|\)::InputState' 'InputState'
Change-Id: I4cc18814fb1fbdd1f240aabba05aae79c54a4841
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227642
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 607d6f4..55de6f8 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -1369,7 +1369,7 @@
return inv.mapXY(x, y);
}
-bool Viewer::onTouch(intptr_t owner, Window::InputState state, float x, float y) {
+bool Viewer::onTouch(intptr_t owner, InputState state, float x, float y) {
if (GestureDevice::kMouse == fGestureDevice) {
return false;
}
@@ -1382,7 +1382,7 @@
void* castedOwner = reinterpret_cast<void*>(owner);
switch (state) {
- case Window::kUp_InputState: {
+ case InputState::kUp: {
fGesture.touchEnd(castedOwner);
#if defined(SK_BUILD_FOR_IOS)
// TODO: move IOS swipe detection higher up into the platform code
@@ -1403,11 +1403,11 @@
#endif
break;
}
- case Window::kDown_InputState: {
+ case InputState::kDown: {
fGesture.touchBegin(castedOwner, x, y);
break;
}
- case Window::kMove_InputState: {
+ case InputState::kMove: {
fGesture.touchMoved(castedOwner, x, y);
break;
}
@@ -1417,7 +1417,7 @@
return true;
}
-bool Viewer::onMouse(int x, int y, Window::InputState state, ModifierKey modifiers) {
+bool Viewer::onMouse(int x, int y, InputState state, ModifierKey modifiers) {
if (GestureDevice::kTouch == fGestureDevice) {
return false;
}
@@ -1429,22 +1429,22 @@
}
switch (state) {
- case Window::kUp_InputState: {
+ case InputState::kUp: {
fGesture.touchEnd(nullptr);
break;
}
- case Window::kDown_InputState: {
+ case InputState::kDown: {
fGesture.touchBegin(nullptr, x, y);
break;
}
- case Window::kMove_InputState: {
+ case InputState::kMove: {
fGesture.touchMoved(nullptr, x, y);
break;
}
}
fGestureDevice = fGesture.isBeingTouched() ? GestureDevice::kMouse : GestureDevice::kNone;
- if (state != Window::kMove_InputState || fGesture.isBeingTouched()) {
+ if (state != InputState::kMove || fGesture.isBeingTouched()) {
fWindow->inval();
}
return true;
@@ -2341,7 +2341,7 @@
}
}
-bool Viewer::onKey(sk_app::Window::Key key, sk_app::Window::InputState state, ModifierKey modifiers) {
+bool Viewer::onKey(sk_app::Window::Key key, InputState state, ModifierKey modifiers) {
return fCommands.onKey(key, state, modifiers);
}