shithub: picker

Download patch

ref: 82e9ef3fd35513bc77e6c544a429a177e53da284
parent: 99f6620b2cbfab36556a4c2d6c7a0f428fbe268d
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Wed Aug 10 06:20:46 EDT 2022

draw to a backing image first

--- a/picker.c
+++ b/picker.c
@@ -124,7 +124,7 @@
 static int ncolors;
 static Rectangle srects[3];
 static Space *space;
-static Image *bg;
+static Image *bg, *coli;
 static char hex[12];
 static int once;
 
@@ -262,8 +262,9 @@
 
 	/* current color */
 	r.max.y = screen->r.max.y - Offset;
-	draw(screen, r, bg, nil, ZP);
-	draw(screen, r, color->i, nil, ZP);
+	draw(coli, bg->r, bg, nil, ZP);
+	draw(coli, bg->r, color->i, nil, ZP);
+	draw(screen, r, coli, nil, ZP);
 
 	/* current color id */
 	r.min.x += Dx(r)/2 - stringwidth(font, color->id)/2;
@@ -545,6 +546,7 @@
 	display->locking = 1;
 	unlockdisplay(display);
 	loadbg();
+	coli = allocimage(display, bg->r, XRGB32, 1, DNofill);
 	slider = -1;
 
 	proccreate(readcolors, b, 4096);