1
0
mirror of https://github.com/aseprite/aseprite.git synced 2025-03-29 01:20:17 +00:00

Fix bug using uninitialized prev_x and prev_y values in Editor::editor_click.

This commit is contained in:
David Capello 2010-12-10 22:54:40 -03:00
parent b231be51e1
commit 06be16ad59

@ -81,8 +81,8 @@ void Editor::editor_click_done()
clear_keybuf(); clear_keybuf();
} }
/* returns false when the user stop the click-loop: releases the // Returns false when the user stop the click-loop: releases the
button or press the second click (depend of the mode) */ // button or press the second click (depend of the mode)
int Editor::editor_click(int *x, int *y, int *update, int Editor::editor_click(int *x, int *y, int *update,
void (*scroll_callback) (int before_change)) void (*scroll_callback) (int before_change))
{ {
@ -106,7 +106,6 @@ int Editor::editor_click(int *x, int *y, int *update,
*update = jmouse_poll(); *update = jmouse_poll();
if (!editor_cursor_is_subpixel())
screen_to_editor(click_last_x, click_last_y, &prev_x, &prev_y); screen_to_editor(click_last_x, click_last_y, &prev_x, &prev_y);
click_prev_last_b = click_last_b; click_prev_last_b = click_last_b;
@ -154,13 +153,13 @@ int Editor::editor_click(int *x, int *y, int *update,
(*scroll_callback)(false); (*scroll_callback)(false);
} }
/* if the cursor hasn't subpixel movement */ // If the cursor hasn't subpixel movement
if (!editor_cursor_is_subpixel()) { if (!editor_cursor_is_subpixel()) {
/* check if the mouse change to other pixel of the sprite */ // Check if the mouse change to other pixel of the sprite
*update = ((prev_x != *x) || (prev_y != *y)); *update = ((prev_x != *x) || (prev_y != *y));
} }
else { else {
/* check if the mouse change to other pixel of the screen */ // Check if the mouse change to other pixel of the screen
*update = ((prev_x != click_last_x) || (prev_y != click_last_y)); *update = ((prev_x != click_last_x) || (prev_y != click_last_y));
} }