From e63e84a5dfb18e9b7eca8dabcd2d58ceac342529 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 4 Jun 2010 13:22:50 +0000 Subject: Convert some more stuff to mylcd_ and support pgfx as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26543 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/test_gfx.c | 116 ++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 59 deletions(-) (limited to 'apps/plugins/test_gfx.c') diff --git a/apps/plugins/test_gfx.c b/apps/plugins/test_gfx.c index 0a2e02e43f..3ba8956109 100644 --- a/apps/plugins/test_gfx.c +++ b/apps/plugins/test_gfx.c @@ -19,16 +19,14 @@ #include "plugin.h" #include "lib/grey.h" #include "lib/helper.h" +#include "lib/mylcd.h" //#define TEST_GREYLIB /* Uncomment for testing greylib instead of core gfx */ #ifdef TEST_GREYLIB -#define MYLCD(fn) grey_ ## fn GREY_INFO_STRUCT static unsigned char *gbuf; static size_t gbuf_size = 0; -#else -#define MYLCD(fn) rb->lcd_ ## fn #endif #define DURATION (HZ) /* longer duration gives more precise results */ @@ -67,45 +65,45 @@ static void time_drawpixel(void) int count1, count2, count3, count4; /* Test 1: DRMODE_SOLID */ - MYLCD(set_drawmode)(DRMODE_SOLID); + mylcd_set_drawmode(DRMODE_SOLID); count1 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; while((time_end = *rb->current_tick) - time_start < DURATION) { unsigned rnd = rand_table[count1++ & 0x3ff]; - MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f); + mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f); } /* Test 2: DRMODE_FG */ - MYLCD(set_drawmode)(DRMODE_FG); + mylcd_set_drawmode(DRMODE_FG); count2 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; while((time_end = *rb->current_tick) - time_start < DURATION) { unsigned rnd = rand_table[count2++ & 0x3ff]; - MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f); + mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f); } /* Test 3: DRMODE_BG */ - MYLCD(set_drawmode)(DRMODE_BG); + mylcd_set_drawmode(DRMODE_BG); count3 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; while((time_end = *rb->current_tick) - time_start < DURATION) { unsigned rnd = rand_table[count3++ & 0x3ff]; - MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f); + mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f); } /* Test 4: DRMODE_COMPLEMENT */ - MYLCD(set_drawmode)(DRMODE_COMPLEMENT); + mylcd_set_drawmode(DRMODE_COMPLEMENT); count4 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; while((time_end = *rb->current_tick) - time_start < DURATION) { unsigned rnd = rand_table[count4++ & 0x3ff]; - MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f); + mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f); } rb->fdprintf(log_fd, "lcd_drawpixel (pixels/s): %d/%d/%d/%d\n", @@ -119,7 +117,7 @@ static void time_drawline(void) int count1, count2, count3, count4; /* Test 1: DRMODE_SOLID */ - MYLCD(set_drawmode)(DRMODE_SOLID); + mylcd_set_drawmode(DRMODE_SOLID); count1 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -127,12 +125,12 @@ static void time_drawline(void) { unsigned rnd1 = rand_table[count1++ & 0x3ff]; unsigned rnd2 = rand_table[count1++ & 0x3ff]; - MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, - (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); + mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, + (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); } /* Test 2: DRMODE_FG */ - MYLCD(set_drawmode)(DRMODE_FG); + mylcd_set_drawmode(DRMODE_FG); count2 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -140,11 +138,11 @@ static void time_drawline(void) { unsigned rnd1 = rand_table[count2++ & 0x3ff]; unsigned rnd2 = rand_table[count2++ & 0x3ff]; - MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, - (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); + mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, + (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); } /* Test 3: DRMODE_BG */ - MYLCD(set_drawmode)(DRMODE_BG); + mylcd_set_drawmode(DRMODE_BG); count3 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -152,11 +150,11 @@ static void time_drawline(void) { unsigned rnd1 = rand_table[count3++ & 0x3ff]; unsigned rnd2 = rand_table[count3++ & 0x3ff]; - MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, - (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); + mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, + (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); } /* Test 4: DRMODE_COMPLEMENT */ - MYLCD(set_drawmode)(DRMODE_COMPLEMENT); + mylcd_set_drawmode(DRMODE_COMPLEMENT); count4 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -164,8 +162,8 @@ static void time_drawline(void) { unsigned rnd1 = rand_table[count4++ & 0x3ff]; unsigned rnd2 = rand_table[count4++ & 0x3ff]; - MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, - (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); + mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, + (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); } rb->fdprintf(log_fd, "lcd_drawline (lines/s): %d/%d/%d/%d\n", @@ -179,7 +177,7 @@ static void time_hline(void) int count1, count2, count3, count4; /* Test 1: DRMODE_SOLID */ - MYLCD(set_drawmode)(DRMODE_SOLID); + mylcd_set_drawmode(DRMODE_SOLID); count1 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -187,11 +185,11 @@ static void time_hline(void) { unsigned rnd1 = rand_table[count1++ & 0x3ff]; unsigned rnd2 = rand_table[count1++ & 0x3ff]; - MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); + mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); } /* Test 2: DRMODE_FG */ - MYLCD(set_drawmode)(DRMODE_FG); + mylcd_set_drawmode(DRMODE_FG); count2 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -199,10 +197,10 @@ static void time_hline(void) { unsigned rnd1 = rand_table[count2++ & 0x3ff]; unsigned rnd2 = rand_table[count2++ & 0x3ff]; - MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); + mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); } /* Test 3: DRMODE_BG */ - MYLCD(set_drawmode)(DRMODE_BG); + mylcd_set_drawmode(DRMODE_BG); count3 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -210,10 +208,10 @@ static void time_hline(void) { unsigned rnd1 = rand_table[count3++ & 0x3ff]; unsigned rnd2 = rand_table[count3++ & 0x3ff]; - MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); + mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); } /* Test 4: DRMODE_COMPLEMENT */ - MYLCD(set_drawmode)(DRMODE_COMPLEMENT); + mylcd_set_drawmode(DRMODE_COMPLEMENT); count4 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -221,7 +219,7 @@ static void time_hline(void) { unsigned rnd1 = rand_table[count4++ & 0x3ff]; unsigned rnd2 = rand_table[count4++ & 0x3ff]; - MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); + mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); } rb->fdprintf(log_fd, "lcd_hline (lines/s): %d/%d/%d/%d\n", @@ -235,7 +233,7 @@ static void time_vline(void) int count1, count2, count3, count4; /* Test 1: DRMODE_SOLID */ - MYLCD(set_drawmode)(DRMODE_SOLID); + mylcd_set_drawmode(DRMODE_SOLID); count1 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -243,11 +241,11 @@ static void time_vline(void) { unsigned rnd1 = rand_table[count1++ & 0x3ff]; unsigned rnd2 = rand_table[count1++ & 0x3ff]; - MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); + mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); } /* Test 2: DRMODE_FG */ - MYLCD(set_drawmode)(DRMODE_FG); + mylcd_set_drawmode(DRMODE_FG); count2 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -255,10 +253,10 @@ static void time_vline(void) { unsigned rnd1 = rand_table[count2++ & 0x3ff]; unsigned rnd2 = rand_table[count2++ & 0x3ff]; - MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); + mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); } /* Test 3: DRMODE_BG */ - MYLCD(set_drawmode)(DRMODE_BG); + mylcd_set_drawmode(DRMODE_BG); count3 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -266,10 +264,10 @@ static void time_vline(void) { unsigned rnd1 = rand_table[count3++ & 0x3ff]; unsigned rnd2 = rand_table[count3++ & 0x3ff]; - MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); + mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); } /* Test 4: DRMODE_COMPLEMENT */ - MYLCD(set_drawmode)(DRMODE_COMPLEMENT); + mylcd_set_drawmode(DRMODE_COMPLEMENT); count4 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -277,7 +275,7 @@ static void time_vline(void) { unsigned rnd1 = rand_table[count4++ & 0x3ff]; unsigned rnd2 = rand_table[count4++ & 0x3ff]; - MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); + mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); } rb->fdprintf(log_fd, "lcd_vline (lines/s): %d/%d/%d/%d\n", @@ -291,7 +289,7 @@ static void time_fillrect(void) int count1, count2, count3, count4; /* Test 1: DRMODE_SOLID */ - MYLCD(set_drawmode)(DRMODE_SOLID); + mylcd_set_drawmode(DRMODE_SOLID); count1 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -299,12 +297,12 @@ static void time_fillrect(void) { unsigned rnd1 = rand_table[count1++ & 0x3ff]; unsigned rnd2 = rand_table[count1++ & 0x3ff]; - MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, - (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); + mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, + (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); } /* Test 2: DRMODE_FG */ - MYLCD(set_drawmode)(DRMODE_FG); + mylcd_set_drawmode(DRMODE_FG); count2 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -312,11 +310,11 @@ static void time_fillrect(void) { unsigned rnd1 = rand_table[count2++ & 0x3ff]; unsigned rnd2 = rand_table[count2++ & 0x3ff]; - MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, - (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); + mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, + (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); } /* Test 3: DRMODE_BG */ - MYLCD(set_drawmode)(DRMODE_BG); + mylcd_set_drawmode(DRMODE_BG); count3 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -324,11 +322,11 @@ static void time_fillrect(void) { unsigned rnd1 = rand_table[count3++ & 0x3ff]; unsigned rnd2 = rand_table[count3++ & 0x3ff]; - MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, - (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); + mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, + (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); } /* Test 4: DRMODE_COMPLEMENT */ - MYLCD(set_drawmode)(DRMODE_COMPLEMENT); + mylcd_set_drawmode(DRMODE_COMPLEMENT); count4 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; @@ -336,8 +334,8 @@ static void time_fillrect(void) { unsigned rnd1 = rand_table[count4++ & 0x3ff]; unsigned rnd2 = rand_table[count4++ & 0x3ff]; - MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, - (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); + mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, + (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); } rb->fdprintf(log_fd, "lcd_fillrect (rects/s): %d/%d/%d/%d\n", @@ -353,45 +351,45 @@ static void time_text(void) /* tests mono_bitmap performance */ rb->lcd_setfont(FONT_SYSFIXED); /* Test 1: DRMODE_SOLID */ - MYLCD(set_drawmode)(DRMODE_SOLID); + mylcd_set_drawmode(DRMODE_SOLID); count1 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; while((time_end = *rb->current_tick) - time_start < DURATION) { unsigned rnd = rand_table[count1++ & 0x3ff]; - MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); + mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); } /* Test 2: DRMODE_FG */ - MYLCD(set_drawmode)(DRMODE_FG); + mylcd_set_drawmode(DRMODE_FG); count2 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; while((time_end = *rb->current_tick) - time_start < DURATION) { unsigned rnd = rand_table[count2++ & 0x3ff]; - MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); + mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); } /* Test 3: DRMODE_BG */ - MYLCD(set_drawmode)(DRMODE_BG); + mylcd_set_drawmode(DRMODE_BG); count3 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; while((time_end = *rb->current_tick) - time_start < DURATION) { unsigned rnd = rand_table[count3++ & 0x3ff]; - MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); + mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); } /* Test 4: DRMODE_COMPLEMENT */ - MYLCD(set_drawmode)(DRMODE_COMPLEMENT); + mylcd_set_drawmode(DRMODE_COMPLEMENT); count4 = 0; rb->sleep(0); /* sync to tick */ time_start = *rb->current_tick; while((time_end = *rb->current_tick) - time_start < DURATION) { unsigned rnd = rand_table[count4++ & 0x3ff]; - MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); + mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); } rb->fdprintf(log_fd, "lcd_putsxy (strings/s): %d/%d/%d/%d\n", -- cgit v1.2.3