From ef1d927d1402d4797ca10a5e8783c4faa894b3b4 Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Wed, 2 Sep 2015 19:00:24 +0200 Subject: [PATCH] Clean the demo app --- kandinsky/src/pixel.c | 4 ++-- src/hello.cpp | 55 ++++--------------------------------------- 2 files changed, 6 insertions(+), 53 deletions(-) diff --git a/kandinsky/src/pixel.c b/kandinsky/src/pixel.c index a77e3e8d0..82b62104a 100644 --- a/kandinsky/src/pixel.c +++ b/kandinsky/src/pixel.c @@ -12,8 +12,8 @@ static inline void set_color(KDColor * address, int8_t high_bit, int8_t low_bit, assert(low_bit >= 0); // Interval starts too early assert(low_bit < 8*sizeof(KDColor)); // Interval ends too late KDColor mask = ((((KDColor)1<<(high_bit-low_bit+1))-1)<= KD_FRAMEBUFFER_ADDRESS); - assert(address < (KD_FRAMEBUFFER_ADDRESS+(KD_FRAMEBUFFER_WIDTH*KD_FRAMEBUFFER_HEIGHT*KD_BITS_PER_PIXEL)/8)); + assert((void *)address >= KD_FRAMEBUFFER_ADDRESS); + assert((void *)address < (KD_FRAMEBUFFER_ADDRESS+(KD_FRAMEBUFFER_WIDTH*KD_FRAMEBUFFER_HEIGHT*KD_BITS_PER_PIXEL)/8)); *address = (*address & ~mask) | (value & mask); } diff --git a/src/hello.cpp b/src/hello.cpp index a01a0c9a1..abe5dc5c6 100644 --- a/src/hello.cpp +++ b/src/hello.cpp @@ -9,53 +9,12 @@ extern "C" { void hello() { - /*char letter = 'Z'; - while (1) { - letter = getc(); - } - */ - KDFillRect((KDRect){ .x = 0, .y = 0, - .width = 240, - .height = 320}, - 0x00); - /* - for (int i=0; i <255; i++) { - KDFillRect((KDRect){.x = (KDCoordinate)i, .y = (KDCoordinate)i, .width = 100, .height = 200}, i); - } - KDDrawString("Hello, world", (KDPoint){}); - */ - - /* - - Number n1 = Number(123); - Number n2 = Number(45); - - Fraction f = Fraction(&n1, &n2); - - Number n3 = Number(3); - Power p = Power(&f, &n3); - - p.recursiveLayout(); - p.m_frame.origin = KDPOINT(0, 0); - p.recursiveDraw(); - - - char * test = (char *)malloc(10); - char * bar = (char *)malloc(8); - - free(bar); - free(test); - */ -/* - while (1) { - char character = getc(); - KDDrawChar(character, (KDPoint){.x = 0, .y = 0}); - } - */ - + .width = 320, + .height = 240}, + 0x7F); char input[255]; @@ -69,13 +28,7 @@ void hello() { } else { input[index++] = character; input[index] = 0; - KDDrawString(input, (KDPoint){.x = 0, .y = 0}); + KDDrawString(input, (KDPoint){.x = 40, .y = 40}); } } - - /* - char * input = "12/34/8787/29292929"; - CreateFromString(input); -*/ - }