~rabbits/orca-toy

6e80c39ebb1d6de5535262d0f90a39b7a98f50d7 — neauoire 2 years ago 015451c
Dont redraw needlessly on select
1 files changed, 9 insertions(+), 5 deletions(-)

M orca.c
M orca.c => orca.c +9 -5
@@ 459,11 459,15 @@ setmode(int v)
void
select(int x, int y, int w, int h)
{
	cursor.x = clamp(x, 0, HOR - 1);
	cursor.y = clamp(y, 0, VER - 1);
	cursor.w = clamp(w, 1, HOR - x + 1);
	cursor.h = clamp(h, 1, VER - y + 1);
	redraw(pixels);
	Rect2d r;
	r.x = clamp(x, 0, HOR - 1);
	r.y = clamp(y, 0, VER - 1);
	r.w = clamp(w, 1, HOR - x + 1);
	r.h = clamp(h, 1, VER - y + 1);
	if(r.x != cursor.x || r.y != cursor.y || r.w != cursor.w || r.h != cursor.h) {
		cursor = r;
		redraw(pixels);
	}
}

void