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

Side by Side Diff: tools/viewer/Viewer.cpp

Issue 2047443002: Use intptr_t for onTouch argument. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « tools/viewer/Viewer.h ('k') | tools/viewer/sk_app/Window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « tools/viewer/Viewer.h ('k') | tools/viewer/sk_app/Window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698