shithub: neindaw

Download patch

ref: abebab3746b86e330baed2e96b62f018da3a680c
parent: cff935522f7f1831a699e269f5fbbd56f256d0a3
author: Sigrid Haflínudóttir <[email protected]>
date: Tue Dec 31 23:33:27 EST 2019

circle: fix wrong offset

--- a/cfg/nk.c
+++ b/cfg/nk.c
@@ -100,6 +100,7 @@
 
 	rect.min = screen->r.min;
 	p = rect.min;
+	sp = p;
 
 	nk_foreach(cmd, ctx) {
 		switch (cmd->type) {
@@ -119,10 +120,10 @@
 		case NK_COMMAND_LINE:
 			{
 				const struct nk_command_line *l = (void*)cmd;
-				sp.x = p.x + l->end.x;
-				sp.y = p.y + l->end.y;
 				p.x += l->begin.x;
 				p.y += l->begin.y;
+				sp.x += l->end.x;
+				sp.y += l->end.y;
 				line(screen, p, sp, Endsquare, Endsquare, THICK(l->line_thickness), nk_color_p9(l->color), ZP);
 			}
 			break;
@@ -157,8 +158,8 @@
 		case NK_COMMAND_CIRCLE:
 			{
 				const struct nk_command_circle *c = (void*)cmd;
-				p.x += c->x + c->w/2;
-				p.y += c->y + c->h/2 - 1;
+				p.x += c->x + c->w/4;
+				p.y += c->y - c->h/4;
 				ellipse(screen, p, c->w/2, c->h/2, THICK(c->line_thickness), nk_color_p9(c->color), ZP);
 			}
 			break;