Avoid color picker crosshairs blitting outside zones

This commit is contained in:
Bill Kendrick 2022-03-17 01:09:50 -07:00
parent b568bf86d2
commit 7856e7af6c

View file

@ -22010,12 +22010,6 @@ static int do_color_picker(void)
draw_color_picker_values(color_picker_val_left, color_picker_val_top); draw_color_picker_values(color_picker_val_left, color_picker_val_top);
/* Draw crosshairs */
draw_color_picker_crosshairs(color_picker_left, color_picker_top, color_picker_val_left, color_picker_val_top);
/* Determine spot for example color: */ /* Determine spot for example color: */
color_example_dest.x = color_picker_left + img_color_picker->w + 2 + img_back->w + 2; color_example_dest.x = color_picker_left + img_color_picker->w + 2 + img_back->w + 2;
@ -22076,6 +22070,27 @@ static int do_color_picker(void)
SDL_Flip(screen); SDL_Flip(screen);
/* Draw crosshairs */
/* (N.B. - We do this the first time _after_ flipping the entire screen,
so we avoid updating parts of the screen where the crosshairs
extend past the rainbow rectangle or value slider, since this
function does not (yet) do any clipping) */
draw_color_picker_crosshairs(color_picker_left, color_picker_top, color_picker_val_left, color_picker_val_top);
dest.x = color_picker_left;
dest.y = color_picker_top;
dest.w = img_color_picker->w;
dest.h = img_color_picker->h;
SDL_UpdateRect(screen, dest.x, dest.y, dest.w, dest.h);
dest.x = color_picker_val_left;
dest.y = color_picker_val_top;
dest.w = img_back->w;
dest.h = img_color_picker_val->h;
SDL_UpdateRect(screen, dest.x, dest.y, dest.w, dest.h);
/* Let the user pick a color, or go back: */ /* Let the user pick a color, or go back: */
done = 0; done = 0;