Avoid stamp & eraser XOR garbage when using quick eraser
(Click+[X])
This commit is contained in:
parent
222d5f925b
commit
b71a4d2987
2 changed files with 33 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ Copyright (c) 2002-2023
|
|||
Various contributors (see below, and AUTHORS.txt)
|
||||
https://tuxpaint.org/
|
||||
|
||||
2023.July.17 (0.9.31)
|
||||
2023.July.19 (0.9.31)
|
||||
* New Magic Tools:
|
||||
----------------
|
||||
* Loops - Draw loop-the-loops.
|
||||
|
|
@ -120,7 +120,8 @@ https://tuxpaint.org/
|
|||
Bill Kendrick <bill@newbreedsoftware.com>
|
||||
|
||||
* Improved Eraser XOR outline when using Ctrl-Z & Ctrl-R
|
||||
for Undo/Redo.
|
||||
for Undo/Redo, and Eraser and Stamp XOR outlines when
|
||||
using click+X for quick eraser access.
|
||||
Bill Kendrick <bill@newbreedsoftware.com>
|
||||
|
||||
* When specifying "datadir", Tux Paint's "New" dialog
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
(See COPYING.txt)
|
||||
|
||||
June 14, 2002 - July 8, 2023
|
||||
June 14, 2002 - July 19, 2023
|
||||
*/
|
||||
|
||||
#include "platform.h"
|
||||
|
|
@ -5186,7 +5186,9 @@ static void mainloop(void)
|
|||
else if (cur_tool == TOOL_STAMP)
|
||||
{
|
||||
if (stamp_tool_mode == STAMP_TOOL_MODE_ROTATE)
|
||||
{
|
||||
stamp_xor(stamp_place_x, stamp_place_y);
|
||||
}
|
||||
else if (stamp_xored)
|
||||
{
|
||||
stamp_xor(canvas->w / 2, canvas->h / 2);
|
||||
|
|
@ -5265,7 +5267,24 @@ static void mainloop(void)
|
|||
(cur_tool != TOOL_STAMP || stamp_tool_mode == STAMP_TOOL_MODE_PLACE) &&
|
||||
cur_tool != TOOL_TEXT && cur_tool != TOOL_LABEL)
|
||||
{
|
||||
/* Jump into quick eraser loop */
|
||||
do_quick_eraser();
|
||||
|
||||
/* Avoid XOR outlines from getting drawn
|
||||
at our initial "click + [X]" position */
|
||||
if (cur_tool == TOOL_STAMP)
|
||||
{
|
||||
reset_stamps(&stamp_xored_rt, &stamp_place_x, &stamp_place_y, &stamp_tool_mode);
|
||||
}
|
||||
else if (cur_tool == TOOL_ERASER)
|
||||
{
|
||||
int mx, my;
|
||||
|
||||
SDL_GetMouseState(&mx, &my);
|
||||
old_x = mx - r_canvas.x;
|
||||
old_y = my - r_canvas.y;
|
||||
maybe_redraw_eraser_xor();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -23924,16 +23943,26 @@ static void do_quick_eraser(void)
|
|||
int val_x, val_y, motioner;
|
||||
int valhat_x, valhat_y, hatmotioner;
|
||||
int done, old_eraser;
|
||||
int mx, my;
|
||||
|
||||
val_x = val_y = motioner = 0;
|
||||
valhat_x = valhat_y = hatmotioner = 0;
|
||||
|
||||
/* Redraw canvas to zap any Stamps or Eraser XOR outlines */
|
||||
update_canvas(0, 0, canvas->w, canvas->h);
|
||||
|
||||
/* Remember current eraser & switch to a suitable default */
|
||||
old_eraser = cur_eraser;
|
||||
cur_eraser = (NUM_ERASER_SIZES * 2) - 2; /* 2nd-smallest circle */
|
||||
|
||||
/* Snapshot the canvas, so we can undo */
|
||||
rec_undo_buffer();
|
||||
|
||||
/* Do an initial erase at the click location */
|
||||
SDL_GetMouseState(&mx, &my);
|
||||
eraser_draw(mx - r_canvas.x, my - r_canvas.y,
|
||||
mx - r_canvas.x, my - r_canvas.y);
|
||||
|
||||
done = 0;
|
||||
do
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue