diff --git a/src/Makefile b/src/Makefile index c1558d4..b23af1d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,6 @@ OBJS=main.o sysinput.o fbinit.o fbprimitive.o log.o gpio.o msg_queue.o time_func.o config.o splash.o LIBS=-lbcm2835 -lpthread +CFLAGS=-g upiwin: $(OBJS) gcc -o upiwin $(OBJS) $(LIBS) diff --git a/src/config.c b/src/config.c index 89cdbfc..4b6dd20 100644 --- a/src/config.c +++ b/src/config.c @@ -46,8 +46,9 @@ static void run_exit_funcs(void) { p = exitfuncs; exitfuncs = p->next; - for (i = p->num_funcs - 1; i >= 0; i++) - (*(p->funcs[i]))(); + for (i = p->num_funcs - 1; i >= 0; i--) + if (p->funcs[i]) + (*(p->funcs[i]))(); free(p); } } diff --git a/src/fbprimitive.c b/src/fbprimitive.c index 2292f48..805dcd4 100644 --- a/src/fbprimitive.c +++ b/src/fbprimitive.c @@ -73,10 +73,10 @@ void Fb_line(INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color, BOOL xor) void Fb_rectangle(INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color, BOOL xor) { - FB_line(x1, y1, x2, y1, color, xor); - FB_line(x2, y1 + 1, x2, y2 - 1, color, xor); - FB_line(x1, y2, x2, y2, color, xor); - FB_line(x1, y1 + 1, x1, y2 - 1, color, xor); + Fb_line(x1, y1, x2, y1, color, xor); + Fb_line(x2, y1 + 1, x2, y2 - 1, color, xor); + Fb_line(x1, y2, x2, y2, color, xor); + Fb_line(x1, y1 + 1, x1, y2 - 1, color, xor); } void Fb_filled_rectangle(INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color, BOOL xor) diff --git a/src/main.c b/src/main.c index bd939e9..414f931 100644 --- a/src/main.c +++ b/src/main.c @@ -14,10 +14,10 @@ static void do_draw(void) { Fb_filled_rectangle(10, 10, 50, 50, FBPRIMCLR_RED, FALSE); Fb_filled_rectangle(60, 10, 100, 50, FBPRIMCLR_GREEN, FALSE); - Fb_filled_rectangle(110, 10, 160, 50, FBPRIMCLR_BLUE, FALSE); + Fb_filled_rectangle(110, 10, 150, 50, FBPRIMCLR_BLUE, FALSE); Fb_filled_rectangle(10, 60, 50, 100, FBPRIMCLR_CYAN, FALSE); Fb_filled_rectangle(60, 60, 100, 100, FBPRIMCLR_MAGENTA, FALSE); - Fb_filled_rectangle(110, 60, 160, 100, FBPRIMCLR_YELLOW, FALSE); + Fb_filled_rectangle(110, 60, 150, 100, FBPRIMCLR_YELLOW, FALSE); } int main(int argc, char *argv[])