summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/fft/fft.c100
-rw-r--r--apps/plugins/lib/mylcd.h142
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c68
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c92
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.h18
-rw-r--r--apps/plugins/mpegplayer/video_out_rockbox.c10
-rw-r--r--apps/plugins/mpegplayer/video_thread.c4
7 files changed, 278 insertions, 156 deletions
diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c
index 28e775a..b971a8f 100644
--- a/apps/plugins/fft/fft.c
+++ b/apps/plugins/fft/fft.c
@@ -22,6 +22,7 @@
#include "lib/helper.h"
#include "lib/xlcd.h"
+#include "lib/mylcd.h"
#include "math.h"
#include "fracmul.h"
@@ -257,16 +258,6 @@ GREY_INFO_STRUCT
#define FFT_SIZE 4096 /* 2048*2 */
#endif
-#ifdef HAVE_LCD_COLOR
-#define lcd_(fn) rb->lcd_##fn
-#define lcd_scroll_up xlcd_scroll_up
-#define lcd_scroll_left xlcd_scroll_left
-#else
-#define lcd_(fn) grey_##fn
-#define lcd_scroll_up grey_scroll_up
-#define lcd_scroll_left grey_scroll_left
-#endif
-
#define ARRAYLEN_IN (FFT_SIZE)
#define ARRAYLEN_OUT (FFT_SIZE)
#define ARRAYLEN_PLOT (FFT_SIZE/2-1) /* FFT is symmetric, ignore DC */
@@ -568,15 +559,14 @@ static void draw_bars_horizontal(void);
static void draw_spectrogram_vertical(void);
static void draw_spectrogram_horizontal(void);
+#define COLOR_DEFAULT_FG MYLCD_DEFAULT_FG
+#define COLOR_DEFAULT_BG MYLCD_DEFAULT_BG
+
#ifdef HAVE_LCD_COLOR
-#define COLOR_DEFAULT_FG LCD_DEFAULT_FG
-#define COLOR_DEFAULT_BG LCD_DEFAULT_BG
#define COLOR_MESSAGE_FRAME LCD_RGBPACK(0xc6, 0x00, 0x00)
#define COLOR_MESSAGE_BG LCD_BLACK
#define COLOR_MESSAGE_FG LCD_WHITE
#else
-#define COLOR_DEFAULT_FG GREY_BLACK
-#define COLOR_DEFAULT_BG GREY_WHITE
#define COLOR_MESSAGE_FRAME GREY_DARKGRAY
#define COLOR_MESSAGE_BG GREY_WHITE
#define COLOR_MESSAGE_FG GREY_BLACK
@@ -588,7 +578,7 @@ static void draw_spectrogram_horizontal(void);
static void draw_message_string(const unsigned char *message, bool active)
{
int x, y;
- lcd_(getstringsize)(message, &x, &y);
+ mylcd_getstringsize(message, &x, &y);
/* x and y give the size of the box for the popup */
x += POPUP_HPADDING*2;
@@ -601,20 +591,20 @@ static void draw_message_string(const unsigned char *message, bool active)
graph_settings.orientation_vertical &&
graph_settings.spectrogram_pos >= LCD_WIDTH - x)
{
- lcd_scroll_left(graph_settings.spectrogram_pos -
- LCD_WIDTH + x);
+ mylcd_scroll_left(graph_settings.spectrogram_pos -
+ LCD_WIDTH + x);
graph_settings.spectrogram_pos = LCD_WIDTH - x - 1;
}
- lcd_(set_foreground)(COLOR_MESSAGE_FRAME);
- lcd_(fillrect)(LCD_WIDTH - x, 0, LCD_WIDTH - 1, y);
+ mylcd_set_foreground(COLOR_MESSAGE_FRAME);
+ mylcd_fillrect(LCD_WIDTH - x, 0, LCD_WIDTH - 1, y);
- lcd_(set_foreground)(COLOR_MESSAGE_FG);
- lcd_(set_background)(COLOR_MESSAGE_BG);
- lcd_(putsxy)(LCD_WIDTH - x + POPUP_HPADDING,
+ mylcd_set_foreground(COLOR_MESSAGE_FG);
+ mylcd_set_background(COLOR_MESSAGE_BG);
+ mylcd_putsxy(LCD_WIDTH - x + POPUP_HPADDING,
POPUP_VPADDING, message);
- lcd_(set_foreground)(COLOR_DEFAULT_FG);
- lcd_(set_background)(COLOR_DEFAULT_BG);
+ mylcd_set_foreground(COLOR_DEFAULT_FG);
+ mylcd_set_background(COLOR_DEFAULT_BG);
}
static void draw(const unsigned char* message)
@@ -647,15 +637,15 @@ static void draw(const unsigned char* message)
if(graph_settings.changed.freq_scale)
graph_settings.changed.freq_scale = true;
- lcd_(set_foreground)(COLOR_DEFAULT_FG);
- lcd_(set_background)(COLOR_DEFAULT_BG);
+ mylcd_set_foreground(COLOR_DEFAULT_FG);
+ mylcd_set_background(COLOR_DEFAULT_BG);
switch (graph_settings.mode)
{
default:
case FFT_DM_LINES: {
- lcd_(clear_display)();
+ mylcd_clear_display();
if (graph_settings.orientation_vertical)
draw_lines_vertical();
@@ -665,7 +655,7 @@ static void draw(const unsigned char* message)
}
case FFT_DM_BARS: {
- lcd_(clear_display());
+ mylcd_clear_display();
if(graph_settings.orientation_vertical)
draw_bars_vertical();
@@ -679,7 +669,7 @@ static void draw(const unsigned char* message)
if(graph_settings.changed.do_clear)
{
graph_settings.spectrogram_pos = 0;
- lcd_(clear_display)();
+ mylcd_clear_display();
}
if(graph_settings.orientation_vertical)
@@ -709,7 +699,7 @@ static void draw(const unsigned char* message)
{
/* Spectrogram mode - need to erase the popup */
int x, y;
- lcd_(getstringsize)(last_message, &x, &y);
+ mylcd_getstringsize(last_message, &x, &y);
/* Recalculate the size */
x += POPUP_HPADDING*2;
y += POPUP_VPADDING*2;
@@ -717,7 +707,7 @@ static void draw(const unsigned char* message)
if(!graph_settings.orientation_vertical)
{
/* In horizontal spectrogram mode, just scroll up by Y lines */
- lcd_scroll_up(y);
+ mylcd_scroll_up(y);
graph_settings.spectrogram_pos -= y;
if(graph_settings.spectrogram_pos < 0)
graph_settings.spectrogram_pos = 0;
@@ -725,10 +715,10 @@ static void draw(const unsigned char* message)
else
{
/* In vertical spectrogram mode, erase the popup */
- lcd_(set_foreground)(COLOR_DEFAULT_BG);
- lcd_(fillrect)(graph_settings.spectrogram_pos + 1, 0,
+ mylcd_set_foreground(COLOR_DEFAULT_BG);
+ mylcd_fillrect(graph_settings.spectrogram_pos + 1, 0,
LCD_WIDTH, y);
- lcd_(set_foreground)(COLOR_DEFAULT_FG);
+ mylcd_set_foreground(COLOR_DEFAULT_FG);
}
}
/* else These modes clear the screen themselves */
@@ -736,7 +726,7 @@ static void draw(const unsigned char* message)
last_message = NULL;
}
- lcd_(update)();
+ mylcd_update();
graph_settings.changed.clear_all = false;
}
@@ -763,7 +753,7 @@ static void draw_lines_vertical(void)
if(this_max == 0)
{
- lcd_(hline)(0, LCD_WIDTH - 1, LCD_HEIGHT - 1); /* Draw all "zero" */
+ mylcd_hline(0, LCD_WIDTH - 1, LCD_HEIGHT - 1); /* Draw all "zero" */
return;
}
@@ -812,7 +802,7 @@ static void draw_lines_vertical(void)
for(x = 0; x < plotwidth; ++x)
{
int h = LCD_HEIGHT*plot[x] / max;
- lcd_(vline)(x + offset, LCD_HEIGHT - h, LCD_HEIGHT-1);
+ mylcd_vline(x + offset, LCD_HEIGHT - h, LCD_HEIGHT-1);
}
}
@@ -838,7 +828,7 @@ static void draw_lines_horizontal(void)
if(this_max == 0)
{
- lcd_(vline)(0, 0, LCD_HEIGHT-1); /* Draw all "zero" */
+ mylcd_vline(0, 0, LCD_HEIGHT-1); /* Draw all "zero" */
return;
}
@@ -888,7 +878,7 @@ static void draw_lines_horizontal(void)
for(y = 0; y < plotwidth; ++y)
{
int w = LCD_WIDTH*plot[y] / max;
- lcd_(hline)(0, w - 1, y + offset);
+ mylcd_hline(0, w - 1, y + offset);
}
}
@@ -909,7 +899,7 @@ static void draw_bars_vertical(void)
if(graph_settings.changed.amp_scale)
max = 0; /* reset the graph on scaling mode change */
- lcd_(hline)(0, LCD_WIDTH-1, LCD_HEIGHT-1); /* Draw baseline */
+ mylcd_hline(0, LCD_WIDTH-1, LCD_HEIGHT-1); /* Draw baseline */
if(calc_magnitudes(graph_settings.logarithmic_amp) == 0)
return; /* nothing more to draw */
@@ -948,7 +938,7 @@ static void draw_bars_vertical(void)
for(i = 0, x = offset; i < bars; ++i, x += barwidth)
{
int h = LCD_HEIGHT * plot[i] / max;
- lcd_(fillrect)(x, LCD_HEIGHT - h, width, h - 1);
+ mylcd_fillrect(x, LCD_HEIGHT - h, width, h - 1);
}
}
@@ -969,7 +959,7 @@ static void draw_bars_horizontal(void)
if(graph_settings.changed.amp_scale)
max = 0; /* reset the graph on scaling mode change */
- lcd_(vline)(0, 0, LCD_HEIGHT-1); /* Draw baseline */
+ mylcd_vline(0, 0, LCD_HEIGHT-1); /* Draw baseline */
if(calc_magnitudes(graph_settings.logarithmic_amp) == 0)
return; /* nothing more to draw */
@@ -1008,7 +998,7 @@ static void draw_bars_horizontal(void)
for(i = 0, y = offset; i < bars; ++i, y += barwidth)
{
int w = LCD_WIDTH * plot[i] / max;
- lcd_(fillrect)(1, y, w, height);
+ mylcd_fillrect(1, y, w, height);
}
}
@@ -1048,8 +1038,8 @@ static void draw_spectrogram_vertical(void)
if(index >= SHADES)
index = SHADES-1;
- lcd_(set_foreground)(SPECTROGRAPH_PALETTE(index));
- lcd_(drawpixel)(graph_settings.spectrogram_pos,
+ mylcd_set_foreground(SPECTROGRAPH_PALETTE(index));
+ mylcd_drawpixel(graph_settings.spectrogram_pos,
scale_factor-1 - y);
if(++y >= scale_factor)
@@ -1063,7 +1053,7 @@ static void draw_spectrogram_vertical(void)
if(graph_settings.spectrogram_pos < LCD_WIDTH-1)
graph_settings.spectrogram_pos++;
else
- lcd_scroll_left(1);
+ mylcd_scroll_left(1);
}
static void draw_spectrogram_horizontal(void)
@@ -1102,8 +1092,8 @@ static void draw_spectrogram_horizontal(void)
if(index >= SHADES)
index = SHADES-1;
- lcd_(set_foreground)(SPECTROGRAPH_PALETTE(index));
- lcd_(drawpixel)(x, graph_settings.spectrogram_pos);
+ mylcd_set_foreground(SPECTROGRAPH_PALETTE(index));
+ mylcd_drawpixel(x, graph_settings.spectrogram_pos);
if(++x >= scale_factor)
break;
@@ -1116,7 +1106,7 @@ static void draw_spectrogram_horizontal(void)
if(graph_settings.spectrogram_pos < LCD_HEIGHT-1)
graph_settings.spectrogram_pos++;
else
- lcd_scroll_up(1);
+ mylcd_scroll_up(1);
}
/********************* End of plotting functions (modes) *********************/
@@ -1334,8 +1324,8 @@ enum plugin_status plugin_start(const void* parameter)
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
- lcd_(clear_display)();
- lcd_(update)();
+ mylcd_clear_display();
+ mylcd_update();
#endif
backlight_force_on();
@@ -1357,9 +1347,9 @@ enum plugin_status plugin_start(const void* parameter)
if(!rb->pcm_is_playing())
{
showing_warning = true;
- lcd_(clear_display)();
+ mylcd_clear_display();
draw_message_string("No audio playing", false);
- lcd_(update)();
+ mylcd_update();
timeout = HZ/5;
}
else
@@ -1367,8 +1357,8 @@ enum plugin_status plugin_start(const void* parameter)
if(showing_warning)
{
showing_warning = false;
- lcd_(clear_display)();
- lcd_(update)();
+ mylcd_clear_display();
+ mylcd_update();
}
timeout = HZ/100; /* 'till end of curent tick, don't use 100% CPU */
diff --git a/apps/plugins/lib/mylcd.h b/apps/plugins/lib/mylcd.h
new file mode 100644
index 0000000..8b6223c
--- /dev/null
+++ b/apps/plugins/lib/mylcd.h
@@ -0,0 +1,142 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (c) 2010 Michael Sevakis
+ *
+ * Helper defines for writing code for both grey and color targets.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef MYLCD_H
+#define MYLCD_H
+
+/***
+ * Most functions are, other than color depth, equivalent between grey, lcd
+ * and xlcd and most of the time the caller need not be concerned with which
+ * is actually called, making code nicer to read and maintain.
+ *
+ * Unbuffered routines revert to standard rb->lcd_XXXX funtions on color
+ * targets. On color, mylcd_ub_update_XXXX refer to the proper update
+ * functions, otherwise they are no-ops.
+ */
+
+#ifdef HAVE_LCD_COLOR
+#define mylcd_(fn) rb->lcd_##fn
+#define myxlcd_(fn) xlcd_##fn
+#define mylcd_ub_(fn) rb->lcd_##fn
+#define myxlcd_ub_(fn) xlcd_##fn
+#else
+#define mylcd_(fn) grey_##fn
+#define myxlcd_(fn) grey_##fn
+#define mylcd_ub_(fn) grey_ub_##fn
+#define myxlcd_ub_(fn) grey_ub_##fn
+#endif
+
+/* Common colors */
+#ifdef HAVE_LCD_COLOR
+#define MYLCD_BLACK LCD_BLACK
+#define MYLCD_DARKGRAY LCD_DARKGRAY
+#define MYLCD_LIGHTGRAY LCD_LIGHTGRAY
+#define MYLCD_WHITE LCD_WHITE
+#define MYLCD_DEFAULT_FG LCD_DEFAULT_FG
+#define MYLCD_DEFAULT_BG LCD_DEFAULT_BG
+#else
+#define MYLCD_BLACK GREY_BLACK
+#define MYLCD_DARKGRAY GREY_DARKGRAY
+#define MYLCD_LIGHTGRAY GREY_LIGHTGRAY
+#define MYLCD_WHITE GREY_WHITE
+#define MYLCD_DEFAULT_FG GREY_BLACK
+#define MYLCD_DEFAULT_BG GREY_WHITE
+#endif /* HAVE_LCD_COLOR */
+
+/* Update functions */
+#define mylcd_update mylcd_(update)
+#define mylcd_update_rect mylcd_(update_rect)
+
+/* Update functions - unbuffered : special handling for these */
+#ifdef HAVE_LCD_COLOR
+#define mylcd_ub_update() rb->lcd_update()
+#define mylcd_ub_update_rect(...) rb->lcd_update_rect(__VA_ARGS__)
+#else
+/* Still evaluate args like functions */
+static inline void mylcd_ub_update(void)
+ {}
+static inline void mylcd_ub_update_rect(int x, int y, int w, int h)
+ { (void)x; (void)y; (void)w; (void)h; }
+#endif
+
+/* Parameter handling */
+#define mylcd_set_drawmode mylcd_(set_drawmode)
+#define mylcd_get_drawmode mylcd_(get_drawmode)
+#define mylcd_set_foreground mylcd_(set_foreground)
+#define mylcd_get_foreground mylcd_(get_foreground)
+#define mylcd_set_background mylcd_(set_background)
+#define mylcd_get_background mylcd_(get_background)
+#define mylcd_set_drawinfo mylcd_(set_drawinfo)
+#define mylcd_setfont mylcd_(setfont)
+#define mylcd_getstringsize mylcd_(getstringsize)
+
+/* Whole display */
+#define mylcd_clear_display mylcd_(clear_display)
+
+/* Whole display - unbuffered */
+#define mylcd_ub_clear_display mylcd_ub_(clear_display)
+
+/* Pixel */
+#define mylcd_drawpixel mylcd_(drawpixel)
+
+/* Lines */
+#define mylcd_drawline mylcd_(drawline)
+#define mylcd_hline mylcd_(hline)
+#define mylcd_vline mylcd_(vline)
+#define mylcd_drawrect mylcd_(drawrect)
+
+/* Filled Primitives */
+#define mylcd_fillrect mylcd_(fillrect)
+#define mylcd_filltriangle myxlcd_(filltriangle)
+
+/* Bitmaps */
+#define mylcd_mono_bitmap_part mylcd_(mono_bitmap_part)
+#define mylcd_mono_bitmap mylcd_(mono_bitmap)
+#define mylcd_gray_bitmap_part myxlcd_(gray_bitmap_part)
+#define mylcd_gray_bitmap myxlcd_(gray_bitmap)
+#if 0 /* possible, but not implemented in greylib */
+#define mylcd_color_bitmap_part myxlcd_(color_bitmap_part)
+#define mylcd_color_bitmap myxlcd_(color_bitmap)
+#endif
+
+/* Bitmaps - unbuffered */
+#define mylcd_ub_gray_bitmap_part myxlcd_ub_(gray_bitmap_part)
+#define mylcd_ub_gray_bitmap myxlcd_ub_(gray_bitmap)
+
+/* Text */
+/* lcd_putsxyofs is static'ed in the core for now on color */
+#define mylcd_putsxyofs mylcd_(putsxyofs)
+#define mylcd_putsxy mylcd_(putsxy)
+
+/* Scrolling */
+#define mylcd_scroll_left myxlcd_(scroll_left)
+#define mylcd_scroll_right myxlcd_(scroll_right)
+#define mylcd_scroll_up myxlcd_(scroll_up)
+#define mylcd_scroll_down myxlcd_(scroll_down)
+
+/* Scrolling - unbuffered */
+#define mylcd_ub_scroll_left myxlcd_ub_(scroll_left)
+#define mylcd_ub_scroll_right myxlcd_ub_(scroll_right)
+#define mylcd_ub_scroll_up myxlcd_ub_(scroll_up)
+#define mylcd_ub_scroll_down myxlcd_ub_(scroll_down)
+
+#endif /* MYLCD_H */
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c
index 1ac2476..1f321c1 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.c
+++ b/apps/plugins/mpegplayer/mpeg_settings.c
@@ -540,11 +540,11 @@ static void grey_splash(int ticks, const unsigned char *fmt, ...)
static void show_loading(struct vo_rect *rc)
{
- int oldmode = lcd_(get_drawmode)();
- lcd_(set_drawmode)(DRMODE_SOLID | DRMODE_INVERSEVID);
- lcd_(fillrect)(rc->l-1, rc->t-1, rc->r - rc->l + 2, rc->b - rc->t + 2);
- lcd_(set_drawmode)(oldmode);
- lcd_(splash)(0, "Loading...");
+ int oldmode = mylcd_get_drawmode();
+ mylcd_set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID);
+ mylcd_fillrect(rc->l-1, rc->t-1, rc->r - rc->l + 2, rc->b - rc->t + 2);
+ mylcd_set_drawmode(oldmode);
+ mylcd_splash(0, "Loading...");
}
static void draw_slider(uint32_t range, uint32_t pos, struct vo_rect *rc)
@@ -567,36 +567,36 @@ static void draw_slider(uint32_t range, uint32_t pos, struct vo_rect *rc)
/* Put positition on left */
ts_to_hms(pos, &hms);
hms_format(str, sizeof(str), &hms);
- lcd_(getstringsize)(str, NULL, &text_h);
+ mylcd_getstringsize(str, NULL, &text_h);
text_y = SLIDER_Y - SLIDER_TEXTMARGIN - text_h;
if (rc == NULL)
{
- int oldmode = lcd_(get_drawmode)();
- lcd_(set_drawmode)(DRMODE_BG | DRMODE_INVERSEVID);
- lcd_(fillrect)(SLIDER_X, text_y, SLIDER_WIDTH,
+ int oldmode = mylcd_get_drawmode();
+ mylcd_set_drawmode(DRMODE_BG | DRMODE_INVERSEVID);
+ mylcd_fillrect(SLIDER_X, text_y, SLIDER_WIDTH,
LCD_HEIGHT - SLIDER_BMARGIN - text_y
- SLIDER_TMARGIN);
- lcd_(set_drawmode)(oldmode);
+ mylcd_set_drawmode(oldmode);
- lcd_(putsxy)(SLIDER_X, text_y, str);
+ mylcd_putsxy(SLIDER_X, text_y, str);
/* Put duration on right */
ts_to_hms(range, &hms);
hms_format(str, sizeof(str), &hms);
- lcd_(getstringsize)(str, &text_w, NULL);
+ mylcd_getstringsize(str, &text_w, NULL);
- lcd_(putsxy)(SLIDER_X + SLIDER_WIDTH - text_w, text_y, str);
+ mylcd_putsxy(SLIDER_X + SLIDER_WIDTH - text_w, text_y, str);
/* Draw slider */
- lcd_(drawrect)(SLIDER_X, SLIDER_Y, SLIDER_WIDTH, SLIDER_HEIGHT);
- lcd_(fillrect)(SLIDER_X, SLIDER_Y,
- muldiv_uint32(pos, SLIDER_WIDTH, range),
- SLIDER_HEIGHT);
+ mylcd_drawrect(SLIDER_X, SLIDER_Y, SLIDER_WIDTH, SLIDER_HEIGHT);
+ mylcd_fillrect(SLIDER_X, SLIDER_Y,
+ muldiv_uint32(pos, SLIDER_WIDTH, range),
+ SLIDER_HEIGHT);
/* Update screen */
- lcd_(update_rect)(SLIDER_X, text_y - SLIDER_TMARGIN, SLIDER_WIDTH,
- LCD_HEIGHT - SLIDER_BMARGIN - text_y + SLIDER_TEXTMARGIN);
+ mylcd_update_rect(SLIDER_X, text_y - SLIDER_TMARGIN, SLIDER_WIDTH,
+ LCD_HEIGHT - SLIDER_BMARGIN - text_y + SLIDER_TEXTMARGIN);
}
else
{
@@ -612,28 +612,28 @@ static bool display_thumb_image(const struct vo_rect *rc)
{
if (!stream_display_thumb(rc))
{
- lcd_(splash)(0, "Frame not available");
+ mylcd_splash(0, "Frame not available");
return false;
}
/* Draw a raised border around the frame */
- int oldcolor = lcd_(get_foreground)();
- lcd_(set_foreground)(DRAW_LIGHTGRAY);
+ int oldcolor = mylcd_get_foreground();
+ mylcd_set_foreground(MYLCD_LIGHTGRAY);
- lcd_(hline)(rc->l-1, rc->r-1, rc->t-1);
- lcd_(vline)(rc->l-1, rc->t, rc->b-1);
+ mylcd_hline(rc->l-1, rc->r-1, rc->t-1);
+ mylcd_vline(rc->l-1, rc->t, rc->b-1);
- lcd_(set_foreground)(DRAW_DARKGRAY);
+ mylcd_set_foreground(MYLCD_DARKGRAY);
- lcd_(hline)(rc->l-1, rc->r, rc->b);
- lcd_(vline)(rc->r, rc->t-1, rc->b);
+ mylcd_hline(rc->l-1, rc->r, rc->b);
+ mylcd_vline(rc->r, rc->t-1, rc->b);
- lcd_(set_foreground)(oldcolor);
+ mylcd_set_foreground(oldcolor);
- lcd_(update_rect)(rc->l-1, rc->t-1, rc->r - rc->l + 2, 1);
- lcd_(update_rect)(rc->l-1, rc->t, 1, rc->b - rc->t);
- lcd_(update_rect)(rc->l-1, rc->b, rc->r - rc->l + 2, 1);
- lcd_(update_rect)(rc->r, rc->t, 1, rc->b - rc->t);
+ mylcd_update_rect(rc->l-1, rc->t-1, rc->r - rc->l + 2, 1);
+ mylcd_update_rect(rc->l-1, rc->t, 1, rc->b - rc->t);
+ mylcd_update_rect(rc->l-1, rc->b, rc->r - rc->l + 2, 1);
+ mylcd_update_rect(rc->r, rc->t, 1, rc->b - rc->t);
return true;
}
@@ -679,8 +679,8 @@ static int get_start_time(uint32_t duration)
enum state_enum slider_state = STATE0;
- lcd_(clear_display)();
- lcd_(update)();
+ mylcd_clear_display();
+ mylcd_update();
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
rb->add_event(LCD_EVENT_ACTIVATION, false, get_start_time_lcd_enable_hook);
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index ee38484..961214f 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -473,7 +473,7 @@ static unsigned draw_blendcolor(unsigned c1, unsigned c2, unsigned char amount)
* The origin is the upper-left corner of the OSD area */
static void draw_update_rect(int x, int y, int width, int height)
{
- lcd_(update_rect)(_X, _Y, _W, _H);
+ mylcd_update_rect(_X, _Y, _W, _H);
}
static void draw_clear_area(int x, int y, int width, int height)
@@ -495,34 +495,34 @@ static void draw_clear_area_rect(const struct vo_rect *rc)
static void draw_fillrect(int x, int y, int width, int height)
{
- lcd_(fillrect)(_X, _Y, _W, _H);
+ mylcd_fillrect(_X, _Y, _W, _H);
}
static void draw_hline(int x1, int x2, int y)
{
#ifdef LCD_LANDSCAPE
- lcd_(hline)(x1 + osd.x, x2 + osd.x, y + osd.y);
+ mylcd_hline(x1 + osd.x, x2 + osd.x, y + osd.y);
#else
y = LCD_WIDTH - (y + osd.y) - 1;
- lcd_(vline)(y, x1 + osd.x, x2 + osd.x);
+ mylcd_vline(y, x1 + osd.x, x2 + osd.x);
#endif
}
static void draw_vline(int x, int y1, int y2)
{
#ifdef LCD_LANDSCAPE
- lcd_(vline)(x + osd.x, y1 + osd.y, y2 + osd.y);
+ mylcd_vline(x + osd.x, y1 + osd.y, y2 + osd.y);
#else
y1 = LCD_WIDTH - (y1 + osd.y) - 1;
y2 = LCD_WIDTH - (y2 + osd.y) - 1;
- lcd_(hline)(y1, y2, x + osd.x);
+ mylcd_hline(y1, y2, x + osd.x);
#endif
}
static void draw_scrollbar_draw(int x, int y, int width, int height,
uint32_t min, uint32_t max, uint32_t val)
{
- unsigned oldfg = lcd_(get_foreground)();
+ unsigned oldfg = mylcd_get_foreground();
draw_hline(x + 1, x + width - 2, y);
draw_hline(x + 1, x + width - 2, y + height - 1);
@@ -534,11 +534,11 @@ static void draw_scrollbar_draw(int x, int y, int width, int height,
draw_fillrect(x + 1, y + 1, val, height - 2);
- lcd_(set_foreground)(osd.prog_fillcolor);
+ mylcd_set_foreground(osd.prog_fillcolor);
draw_fillrect(x + 1 + val, y + 1, width - 2 - val, height - 2);
- lcd_(set_foreground)(oldfg);
+ mylcd_set_foreground(oldfg);
}
static void draw_scrollbar_draw_rect(const struct vo_rect *rc, int min,
@@ -656,18 +656,18 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
int stride, int x, int y,
int width, int height)
{
- int mode = lcd_(get_drawmode)();
- lcd_(set_drawmode)(DRMODE_FG);
- lcd_(mono_bitmap_part)(src, src_x, src_y, stride, x, y, width, height);
- lcd_(set_drawmode)(mode);
+ int mode = mylcd_get_drawmode();
+ mylcd_set_drawmode(DRMODE_FG);
+ mylcd_mono_bitmap_part(src, src_x, src_y, stride, x, y, width, height);
+ mylcd_set_drawmode(mode);
}
static void draw_putsxy_oriented(int x, int y, const char *str)
{
- int mode = lcd_(get_drawmode)();
- lcd_(set_drawmode)(DRMODE_FG);
- lcd_(putsxy)(x + osd.x, y + osd.y, str);
- lcd_(set_drawmode)(mode);
+ int mode = mylcd_get_drawmode();
+ mylcd_set_drawmode(DRMODE_FG);
+ mylcd_putsxy(x + osd.x, y + osd.y, str);
+ mylcd_set_drawmode(mode);
}
#endif /* LCD_PORTRAIT */
@@ -718,7 +718,7 @@ static void osd_text_init(void)
int phys;
int spc_width;
- lcd_(setfont)(FONT_UI);
+ mylcd_setfont(FONT_UI);
osd.x = 0;
osd.width = SCREEN_WIDTH;
@@ -730,7 +730,7 @@ static void osd_text_init(void)
ts_to_hms(stream_get_duration(), &hms);
hms_format(buf, sizeof (buf), &hms);
- lcd_(getstringsize)(buf, &osd.time_rect.r, &osd.time_rect.b);
+ mylcd_getstringsize(buf, &osd.time_rect.r, &osd.time_rect.b);
/* Choose well-sized bitmap images relative to font height */
if (osd.time_rect.b < 12) {
@@ -760,8 +760,8 @@ static void osd_text_init(void)
rb->snprintf(buf, sizeof(buf), "%d%s", phys,
rb->sound_unit(SOUND_VOLUME));
- lcd_(getstringsize)(" ", &spc_width, NULL);
- lcd_(getstringsize)(buf, &osd.vol_rect.r, &osd.vol_rect.b);
+ mylcd_getstringsize(" ", &spc_width, NULL);
+ mylcd_getstringsize(buf, &osd.vol_rect.r, &osd.vol_rect.b);
osd.prog_rect.r = SCREEN_WIDTH - OSD_BDR_L - spc_width -
osd.vol_rect.r - OSD_BDR_R;
@@ -787,7 +787,7 @@ static void osd_text_init(void)
#endif
osd.y = SCREEN_HEIGHT - osd.height;
- lcd_(setfont)(FONT_SYSFIXED);
+ mylcd_setfont(FONT_SYSFIXED);
}
static void osd_init(void)
@@ -836,39 +836,39 @@ static void osd_refresh_background(void)
char buf[32];
struct hms hms;
- unsigned bg = lcd_(get_background)();
- lcd_(set_drawmode)(DRMODE_SOLID | DRMODE_INVERSEVID);
+ unsigned bg = mylcd_get_background();
+ mylcd_set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID);
#ifdef HAVE_LCD_COLOR
/* Draw a "raised" area for our graphics */
- lcd_(set_background)(draw_blendcolor(bg, DRAW_WHITE, 192));
+ mylcd_set_background(draw_blendcolor(bg, MYLCD_WHITE, 192));
draw_hline(0, osd.width, 0);
- lcd_(set_background)(draw_blendcolor(bg, DRAW_WHITE, 80));
+ mylcd_set_background(draw_blendcolor(bg, MYLCD_WHITE, 80));
draw_hline(0, osd.width, 1);
- lcd_(set_background)(draw_blendcolor(bg, DRAW_BLACK, 48));
+ mylcd_set_background(draw_blendcolor(bg, MYLCD_BLACK, 48));
draw_hline(0, osd.width, osd.height-2);
- lcd_(set_background)(draw_blendcolor(bg, DRAW_BLACK, 128));
+ mylcd_set_background(draw_blendcolor(bg, MYLCD_BLACK, 128));
draw_hline(0, osd.width, osd.height-1);
- lcd_(set_background)(bg);
+ mylcd_set_background(bg);
draw_clear_area(0, 2, osd.width, osd.height - 4);
#else
/* Give contrast with the main background */
- lcd_(set_background)(GREY_WHITE);
+ mylcd_set_background(MYLCD_WHITE);
draw_hline(0, osd.width, 0);
- lcd_(set_background)(GREY_DARKGRAY);
+ mylcd_set_background(MYLCD_DARKGRAY);
draw_hline(0, osd.width, osd.height-1);
- lcd_(set_background)(bg);
+ mylcd_set_background(bg);
draw_clear_area(0, 1, osd.width, osd.height - 2);
#endif
vo_rect_set_ext(&osd.update_rect, 0, 0, osd.width, osd.height);
- lcd_(set_drawmode)(DRMODE_SOLID);
+ mylcd_set_drawmode(DRMODE_SOLID);
if (stream_get_duration() != INVALID_TIMESTAMP) {
/* Draw the movie duration */
@@ -912,7 +912,7 @@ static void osd_refresh_volume(void)
rb->snprintf(buf, sizeof (buf), "%d%s",
rb->sound_val2phys(SOUND_VOLUME, volume),
rb->sound_unit(SOUND_VOLUME));
- lcd_(getstringsize)(buf, &width, NULL);
+ mylcd_getstringsize(buf, &width, NULL);
/* Right-justified */
draw_clear_area_rect(&osd.vol_rect);
@@ -930,11 +930,11 @@ static void osd_refresh_status(void)
#ifdef HAVE_LCD_COLOR
/* Draw status icon with a drop shadow */
- unsigned oldfg = lcd_(get_foreground)();
+ unsigned oldfg = mylcd_get_foreground();
int i = 1;
- lcd_(set_foreground)(draw_blendcolor(lcd_(get_background)(),
- DRAW_BLACK, 96));
+ mylcd_set_foreground(draw_blendcolor(mylcd_get_background(),
+ MYLCD_BLACK, 96));
while (1)
{
@@ -949,7 +949,7 @@ static void osd_refresh_status(void)
if (--i < 0)
break;
- lcd_(set_foreground)(oldfg);
+ mylcd_set_foreground(oldfg);
}
vo_rect_union(&osd.update_rect, &osd.update_rect, &osd.stat_rect);
@@ -1076,12 +1076,12 @@ static void osd_refresh(int hint)
/* Set basic drawing params that are used. Elements that perform variations
* will restore them. */
- oldfg = lcd_(get_foreground)();
- oldbg = lcd_(get_background)();
+ oldfg = mylcd_get_foreground();
+ oldbg = mylcd_get_background();
- lcd_(setfont)(FONT_UI);
- lcd_(set_foreground)(osd.fgcolor);
- lcd_(set_background)(osd.bgcolor);
+ mylcd_setfont(FONT_UI);
+ mylcd_set_foreground(osd.fgcolor);
+ mylcd_set_background(osd.bgcolor);
vo_rect_clear(&osd.update_rect);
@@ -1103,9 +1103,9 @@ static void osd_refresh(int hint)
}
/* Go back to defaults */
- lcd_(setfont)(FONT_SYSFIXED);
- lcd_(set_foreground)(oldfg);
- lcd_(set_background)(oldbg);
+ mylcd_setfont(FONT_SYSFIXED);
+ mylcd_set_foreground(oldfg);
+ mylcd_set_background(oldbg);
/* Update the dirty rectangle */
vo_lock();
diff --git a/apps/plugins/mpegplayer/mpegplayer.h b/apps/plugins/mpegplayer/mpegplayer.h
index f6617ce..79c25f6 100644
--- a/apps/plugins/mpegplayer/mpegplayer.h
+++ b/apps/plugins/mpegplayer/mpegplayer.h
@@ -67,24 +67,14 @@
#define DISK_GUARDBUF_SIZE ALIGN_UP(65535+6, 4)
#ifdef HAVE_LCD_COLOR
-#define DRAW_BLACK LCD_BLACK
-#define DRAW_DARKGRAY LCD_DARKGRAY
-#define DRAW_LIGHTGRAY LCD_LIGHTGRAY
-#define DRAW_WHITE LCD_WHITE
-#define lcd_(fn) rb->lcd_##fn
-#define lcd_splash splash
-
+#define mylcd_splash rb->splash
#else
-
#include "lib/grey.h"
-#define DRAW_BLACK GREY_BLACK
-#define DRAW_DARKGRAY GREY_DARKGRAY
-#define DRAW_LIGHTGRAY GREY_LIGHTGRAY
-#define DRAW_WHITE GREY_WHITE
-#define lcd_(fn) grey_##fn
-
+#define mylcd_splash grey_splash
#endif
+#include "lib/mylcd.h"
+
#include "mpeg2.h"
#include "video_out.h"
#include "mpeg_stream.h"
diff --git a/apps/plugins/mpegplayer/video_out_rockbox.c b/apps/plugins/mpegplayer/video_out_rockbox.c
index ee0efb8..cf47982 100644
--- a/apps/plugins/mpegplayer/video_out_rockbox.c
+++ b/apps/plugins/mpegplayer/video_out_rockbox.c
@@ -86,16 +86,16 @@ static void vo_draw_black(void)
video_lock();
- foreground = lcd_(get_foreground)();
+ foreground = mylcd_get_foreground();
- lcd_(set_foreground)(DRAW_BLACK);
+ mylcd_set_foreground(MYLCD_BLACK);
- lcd_(fillrect)(vo.output_x, vo.output_y, vo.output_width,
+ mylcd_fillrect(vo.output_x, vo.output_y, vo.output_width,
vo.output_height);
- lcd_(update_rect)(vo.output_x, vo.output_y, vo.output_width,
+ mylcd_update_rect(vo.output_x, vo.output_y, vo.output_width,
vo.output_height);
- lcd_(set_foreground)(foreground);
+ mylcd_set_foreground(foreground);
video_unlock();
}
diff --git a/apps/plugins/mpegplayer/video_thread.c b/apps/plugins/mpegplayer/video_thread.c
index 6d60e64..8feacbd 100644
--- a/apps/plugins/mpegplayer/video_thread.c
+++ b/apps/plugins/mpegplayer/video_thread.c
@@ -80,10 +80,10 @@ static void draw_fps(struct video_thread_data *td)
td->info->display_picture->temporal_reference,
/* Audio information */
buf_pct, pcm_underruns, pcm_skipped);
- lcd_(putsxy)(0, 0, str);
+ mylcd_putsxy(0, 0, str);
vo_lock();
- lcd_(update_rect)(0, 0, LCD_WIDTH, 8);
+ mylcd_update_rect(0, 0, LCD_WIDTH, 8);
vo_unlock();
td->last_showfps = *rb->current_tick;