From 23d9812273d9c74af72ccdc3aa4cfea971f220a4 Mon Sep 17 00:00:00 2001 From: Andrew Mahone Date: Fri, 16 Jan 2009 10:34:40 +0000 Subject: loader-initialized global plugin API: struct plugin_api *rb is declared in PLUGIN_HEADER, and pointed to by __header.api the loader uses this pointer to initialize rb before calling entry_point entry_point is no longer passed a pointer to the plugin API all plugins, and pluginlib functions, are modified to refer to the global rb pluginlib functions which only served to copy the API pointer are removed git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19776 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/lib/playergfx.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'apps/plugins/lib/playergfx.c') diff --git a/apps/plugins/lib/playergfx.c b/apps/plugins/lib/playergfx.c index c332c02..d07043c 100644 --- a/apps/plugins/lib/playergfx.c +++ b/apps/plugins/lib/playergfx.c @@ -28,7 +28,6 @@ /*** globals ***/ -static const struct plugin_api *pgfx_rb = NULL; /* global api struct pointer */ static int char_width; static int char_height; static int pixel_height; @@ -40,14 +39,13 @@ static int drawmode = DRMODE_SOLID; /*** Special functions ***/ /* library init */ -bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight) +bool pgfx_init(int cwidth, int cheight) { int i; if (((unsigned) cwidth * (unsigned) cheight) > 8 || (unsigned) cheight > 2) return false; - pgfx_rb = newrb; char_width = cwidth; char_height = cheight; pixel_height = 7 * char_height; @@ -55,7 +53,7 @@ bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight) for (i = 0; i < cwidth * cheight; i++) { - if ((gfx_chars[i] = pgfx_rb->lcd_get_locked_pattern()) == 0) + if ((gfx_chars[i] = rb->lcd_get_locked_pattern()) == 0) { pgfx_release(); return false; @@ -72,7 +70,7 @@ void pgfx_release(void) for (i = 0; i < 8; i++) if (gfx_chars[i]) - pgfx_rb->lcd_unlock_pattern(gfx_chars[i]); + rb->lcd_unlock_pattern(gfx_chars[i]); } /* place the display */ @@ -84,12 +82,12 @@ void pgfx_display(int cx, int cy) for (i = 0; i < width; i++) for (j = 0; j < height; j++) - pgfx_rb->lcd_putc(cx + i, cy + j, gfx_chars[char_height * i + j]); + rb->lcd_putc(cx + i, cy + j, gfx_chars[char_height * i + j]); } void pgfx_display_block(int cx, int cy, int x, int y) { - pgfx_rb->lcd_putc(cx, cy, gfx_chars[char_height * x + y]); + rb->lcd_putc(cx, cy, gfx_chars[char_height * x + y]); } @@ -100,9 +98,9 @@ void pgfx_update(void) int i; for (i = 0; i < char_width * char_height; i++) - pgfx_rb->lcd_define_pattern(gfx_chars[i], gfx_buffer + 7 * i); + rb->lcd_define_pattern(gfx_chars[i], gfx_buffer + 7 * i); - pgfx_rb->lcd_update(); + rb->lcd_update(); } /*** Parameter handling ***/ @@ -203,7 +201,7 @@ void pgfx_clear_display(void) { unsigned bits = (drawmode & DRMODE_INVERSEVID) ? 0x1F : 0; - pgfx_rb->memset(gfx_buffer, bits, char_width * pixel_height); + rb->memset(gfx_buffer, bits, char_width * pixel_height); } /* Set a single pixel */ -- cgit v1.1