Use intptr_t for onTouch argument.

On 64-bit platforms, casting int to void* is not valid.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2047443002

Review-Url: https://codereview.chromium.org/2047443002
This commit is contained in:
jvanverth 2016-06-06 08:48:47 -07:00 committed by Commit bot
parent 11450d5ec1
commit 814e38d5c1
4 changed files with 7 additions and 7 deletions

View File

@ -28,7 +28,7 @@ static void on_paint_handler(SkCanvas* canvas, void* userData) {
return vv->onPaint(canvas);
}
static bool on_touch_handler(int owner, Window::InputState state, float x, float y, void* userData)
static bool on_touch_handler(intptr_t owner, Window::InputState state, float x, float y, void* userData)
{
Viewer* viewer = reinterpret_cast<Viewer*>(userData);
@ -332,7 +332,7 @@ void Viewer::onPaint(SkCanvas* canvas) {
fCommands.drawHelp(canvas);
}
bool Viewer::onTouch(int owner, Window::InputState state, float x, float y) {
bool Viewer::onTouch(intptr_t owner, Window::InputState state, float x, float y) {
void* castedOwner = reinterpret_cast<void*>(owner);
SkPoint touchPoint = fDefaultMatrixInv.mapXY(x, y);
switch (state) {

View File

@ -24,7 +24,7 @@ public:
void onPaint(SkCanvas* canvas);
void onIdle(double ms) override;
bool onTouch(int owner, sk_app::Window::InputState state, float x, float y);
bool onTouch(intptr_t owner, sk_app::Window::InputState state, float x, float y);
void onUIStateChanged(const SkString& stateName, const SkString& stateValue);
private:

View File

@ -27,7 +27,7 @@ static bool default_mouse_func(int x, int y, Window::InputState state, uint32_t
return false;
}
static bool default_touch_func(int owner, Window::InputState state, float x, float y,
static bool default_touch_func(intptr_t owner, Window::InputState state, float x, float y,
void* userData) {
return false;
}
@ -62,7 +62,7 @@ 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) {
bool Window::onTouch(intptr_t owner, InputState state, float x, float y) {
return fTouchFunc(owner, state, x, y, fTouchUserData);
}

View File

@ -111,7 +111,7 @@ public:
typedef bool(*OnCharFunc)(SkUnichar c, uint32_t modifiers, void* userData);
typedef bool(*OnKeyFunc)(Key key, InputState state, uint32_t modifiers, void* userData);
typedef bool(*OnMouseFunc)(int x, int y, InputState state, uint32_t modifiers, void* userData);
typedef bool(*OnTouchFunc)(int owner, InputState state, float x, float y, void* userData);
typedef bool(*OnTouchFunc)(intptr_t owner, InputState state, float x, float y, void* userData);
typedef void(*OnUIStateChangedFunc)(
const SkString& stateName, const SkString& stateValue, void* userData);
typedef void(*OnPaintFunc)(SkCanvas*, void* userData);
@ -149,7 +149,7 @@ public:
bool onChar(SkUnichar c, uint32_t modifiers);
bool onKey(Key key, InputState state, uint32_t modifiers);
bool onMouse(int x, int y, InputState state, uint32_t modifiers);
bool onTouch(int owner, InputState state, float x, float y); // multi-owner = multi-touch
bool onTouch(intptr_t owner, InputState state, float x, float y); // multi-owner = multi-touch
void onUIStateChanged(const SkString& stateName, const SkString& stateValue);
void onPaint();
void onResize(uint32_t width, uint32_t height);