From ff83c8c4daa3dd651bfc87ba6dd1c4ad75f7735b Mon Sep 17 00:00:00 2001 From: Felix Raimundo Date: Fri, 1 Apr 2016 15:03:40 +0200 Subject: [PATCH] Draw rectangles with lines. Change-Id: I257ea485e67d2cc1c2ad5f9405fe507f3f4d00f1 --- app/utils.cpp | 10 +--------- kandinsky/include/kandinsky/rect.h | 1 + kandinsky/src/rect.c | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/app/utils.cpp b/app/utils.cpp index 32ce41d99..01efea1d3 100644 --- a/app/utils.cpp +++ b/app/utils.cpp @@ -46,21 +46,13 @@ static void clear_trig_menu() { } static void print_trig_menu() { - { - KDRect r; - r.x = SCREEN_WIDTH / 4 - 1; - r.y = SCREEN_HEIGHT / 4 - 1; - r.width = SCREEN_WIDTH / 2 + 2; - r.height = SCREEN_HEIGHT / 2 + 2; - KDFillRect(r, 0xFF); - } { KDRect r; r.x = SCREEN_WIDTH / 4; r.y = SCREEN_HEIGHT / 4; r.width = SCREEN_WIDTH / 2; r.height = SCREEN_HEIGHT / 2; - KDFillRect(r, 0x00); + KDDrawRect(r, 0xff); } } diff --git a/kandinsky/include/kandinsky/rect.h b/kandinsky/include/kandinsky/rect.h index 442107edf..6bbdeaf48 100644 --- a/kandinsky/include/kandinsky/rect.h +++ b/kandinsky/include/kandinsky/rect.h @@ -24,5 +24,6 @@ typedef struct { extern KDRect KDRectZero; void KDFillRect(KDRect rect, KDColor color); +void KDDrawRect(KDRect rect, KDColor color); #endif diff --git a/kandinsky/src/rect.c b/kandinsky/src/rect.c index 5d8cec101..cc721de3a 100644 --- a/kandinsky/src/rect.c +++ b/kandinsky/src/rect.c @@ -12,3 +12,27 @@ void KDFillRect(KDRect rect, KDColor color) { } } } + +void KDDrawRect(KDRect rect, KDColor color) { + KDPoint p1, p2; + p1.x = rect.x; + p1.y = rect.y; + p2.x = rect.x; + p2.y = rect.y + rect.height; + for (int i = 0; i