OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Viewer.h" | 8 #include "Viewer.h" |
9 | 9 |
10 #include "GMSlide.h" | 10 #include "GMSlide.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 Application* Application::Create(int argc, char** argv, void* platformData) { | 21 Application* Application::Create(int argc, char** argv, void* platformData) { |
22 return new Viewer(argc, argv, platformData); | 22 return new Viewer(argc, argv, platformData); |
23 } | 23 } |
24 | 24 |
25 static void on_paint_handler(SkCanvas* canvas, void* userData) { | 25 static void on_paint_handler(SkCanvas* canvas, void* userData) { |
26 Viewer* vv = reinterpret_cast<Viewer*>(userData); | 26 Viewer* vv = reinterpret_cast<Viewer*>(userData); |
27 | 27 |
28 return vv->onPaint(canvas); | 28 return vv->onPaint(canvas); |
29 } | 29 } |
30 | 30 |
31 static bool on_touch_handler(int owner, Window::InputState state, float x, float
y, void* userData) | 31 static bool on_touch_handler(intptr_t owner, Window::InputState state, float x,
float y, void* userData) |
32 { | 32 { |
33 Viewer* viewer = reinterpret_cast<Viewer*>(userData); | 33 Viewer* viewer = reinterpret_cast<Viewer*>(userData); |
34 | 34 |
35 return viewer->onTouch(owner, state, x, y); | 35 return viewer->onTouch(owner, state, x, y); |
36 } | 36 } |
37 | 37 |
38 static void on_ui_state_changed_handler(const SkString& stateName, const SkStrin
g& stateValue, void* userData) { | 38 static void on_ui_state_changed_handler(const SkString& stateName, const SkStrin
g& stateValue, void* userData) { |
39 Viewer* viewer = reinterpret_cast<Viewer*>(userData); | 39 Viewer* viewer = reinterpret_cast<Viewer*>(userData); |
40 | 40 |
41 return viewer->onUIStateChanged(stateName, stateValue); | 41 return viewer->onUIStateChanged(stateName, stateValue); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 fSlides[fCurrentSlide]->draw(canvas); | 326 fSlides[fCurrentSlide]->draw(canvas); |
327 canvas->restoreToCount(count); | 327 canvas->restoreToCount(count); |
328 | 328 |
329 if (fDisplayStats) { | 329 if (fDisplayStats) { |
330 drawStats(canvas); | 330 drawStats(canvas); |
331 } | 331 } |
332 fCommands.drawHelp(canvas); | 332 fCommands.drawHelp(canvas); |
333 } | 333 } |
334 | 334 |
335 bool Viewer::onTouch(int owner, Window::InputState state, float x, float y) { | 335 bool Viewer::onTouch(intptr_t owner, Window::InputState state, float x, float y)
{ |
336 void* castedOwner = reinterpret_cast<void*>(owner); | 336 void* castedOwner = reinterpret_cast<void*>(owner); |
337 SkPoint touchPoint = fDefaultMatrixInv.mapXY(x, y); | 337 SkPoint touchPoint = fDefaultMatrixInv.mapXY(x, y); |
338 switch (state) { | 338 switch (state) { |
339 case Window::kUp_InputState: { | 339 case Window::kUp_InputState: { |
340 fGesture.touchEnd(castedOwner); | 340 fGesture.touchEnd(castedOwner); |
341 break; | 341 break; |
342 } | 342 } |
343 case Window::kDown_InputState: { | 343 case Window::kDown_InputState: { |
344 fGesture.touchBegin(castedOwner, touchPoint.fX, touchPoint.fY); | 344 fGesture.touchBegin(castedOwner, touchPoint.fX, touchPoint.fY); |
345 break; | 345 break; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 } | 486 } |
487 } else if (stateName.equals(kSoftkeyStateName)) { | 487 } else if (stateName.equals(kSoftkeyStateName)) { |
488 if (!stateValue.equals(kSoftkeyHint)) { | 488 if (!stateValue.equals(kSoftkeyHint)) { |
489 fCommands.onSoftkey(stateValue); | 489 fCommands.onSoftkey(stateValue); |
490 updateUIState(); // This is still needed to reset the value to kSoft
keyHint | 490 updateUIState(); // This is still needed to reset the value to kSoft
keyHint |
491 } | 491 } |
492 } else { | 492 } else { |
493 SkDebugf("Unknown stateName: %s", stateName.c_str()); | 493 SkDebugf("Unknown stateName: %s", stateName.c_str()); |
494 } | 494 } |
495 } | 495 } |
OLD | NEW |