Add the viewport functions to the screens API, including a new getfont() function to return the font used by the current viewport. A change to the screens API makes the plugin API incompatible, so we bump version and sort. Also commit the test_viewports plugin (not built by default). This is some more of FS#8385.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16022 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2008-01-08 01:22:14 +00:00
parent 08e6c6bc2a
commit 3646c31367
14 changed files with 379 additions and 12 deletions

View file

@ -181,6 +181,9 @@ static const struct plugin_api rockbox_api = {
lcd_remote_bitmap, lcd_remote_bitmap,
#endif #endif
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && !defined(SIMULATOR)
lcd_grey_phase_blit,
#endif
#if defined(HAVE_LCD_COLOR) #if defined(HAVE_LCD_COLOR)
lcd_yuv_blit, lcd_yuv_blit,
#endif #endif
@ -583,10 +586,6 @@ static const struct plugin_api rockbox_api = {
sound_unit, sound_unit,
sound_val2phys, sound_val2phys,
#endif /* CONFIG_CODEC == SWCODEC */ #endif /* CONFIG_CODEC == SWCODEC */
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && !defined(SIMULATOR)
lcd_grey_phase_blit,
#endif
}; };
int plugin_load(const char* plugin, void* parameter) int plugin_load(const char* plugin, void* parameter)

View file

@ -119,12 +119,12 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */ #define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */ /* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 94 #define PLUGIN_API_VERSION 95
/* update this to latest version if a change to the api struct breaks /* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */ new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 88 #define PLUGIN_MIN_API_VERSION 95
/* plugin return codes */ /* plugin return codes */
enum plugin_status { enum plugin_status {
@ -267,6 +267,10 @@ struct plugin_api {
void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y, int width, void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y, int width,
int height); int height);
#endif #endif
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && !defined(SIMULATOR)
void (*lcd_grey_phase_blit)(const struct grey_data *data, int bx, int by,
int bwidth, int bheight, int stride);
#endif
#if defined(HAVE_LCD_COLOR) #if defined(HAVE_LCD_COLOR)
void (*lcd_yuv_blit)(unsigned char * const src[3], void (*lcd_yuv_blit)(unsigned char * const src[3],
int src_x, int src_y, int stride, int src_x, int src_y, int stride,
@ -718,11 +722,6 @@ struct plugin_api {
const char * (*sound_unit)(int setting); const char * (*sound_unit)(int setting);
int (*sound_val2phys)(int setting, int value); int (*sound_val2phys)(int setting, int value);
#endif /* CONFIG_CODEC == SWCODEC */ #endif /* CONFIG_CODEC == SWCODEC */
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && !defined(SIMULATOR)
void (*lcd_grey_phase_blit)(const struct grey_data *data, int bx, int by,
int bwidth, int bheight, int stride);
#endif
}; };
/* plugin header */ /* plugin header */

View file

@ -81,6 +81,7 @@ test_disk,apps
test_fps,apps test_fps,apps
test_sampr,apps test_sampr,apps
test_scanrate,apps test_scanrate,apps
test_viewports,apps
text_editor,apps text_editor,apps
vbrfix,viewers vbrfix,viewers
video,viewers video,viewers

View file

@ -0,0 +1,309 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: helloworld.c 12807 2007-03-16 21:56:08Z amiconn $
*
* Copyright (C) 2007 Dave Chapman
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "plugin.h"
PLUGIN_HEADER
static struct plugin_api* rb;
#ifdef HAVE_LCD_BITMAP
#ifdef HAVE_LCD_COLOR
#define BGCOLOR_1 LCD_RGBPACK(255,255,0)
#define BGCOLOR_2 LCD_RGBPACK(0,255,0)
#define FGCOLOR_1 LCD_RGBPACK(0,0,255)
#else if LCD_DEPTH > 1
#define BGCOLOR_1 LCD_DARKGRAY
#define BGCOLOR_2 LCD_LIGHTGRAY
#define FGCOLOR_1 LCD_WHITE
#endif
static struct viewport vp0 =
{
.x = 0,
.y = 0,
.width = LCD_WIDTH,
.height = 20,
.font = FONT_UI,
.drawmode = DRMODE_SOLID,
.xmargin = 0,
.ymargin = 0,
#if LCD_DEPTH > 1
.fg_pattern = LCD_DEFAULT_FG,
.bg_pattern = BGCOLOR_1,
#endif
#ifdef HAVE_LCD_COLOR
.lss_pattern = LCD_DEFAULT_BG,
.lse_pattern = LCD_DEFAULT_BG,
.lst_pattern = LCD_DEFAULT_BG,
#endif
};
static struct viewport vp1 =
{
.x = LCD_WIDTH / 10,
.y = 20,
.width = LCD_WIDTH / 3,
.height = LCD_HEIGHT / 2,
.font = FONT_SYSFIXED,
.drawmode = DRMODE_SOLID,
.xmargin = 0,
.ymargin = 0,
#if LCD_DEPTH > 1
.fg_pattern = LCD_DEFAULT_FG,
.bg_pattern = LCD_DEFAULT_BG,
#ifdef HAVE_LCD_COLOR
.lss_pattern = LCD_DEFAULT_BG,
.lse_pattern = LCD_DEFAULT_BG,
.lst_pattern = LCD_DEFAULT_BG,
#endif
#endif
};
static struct viewport vp2 =
{
.x = LCD_WIDTH / 2,
.y = 40,
.width = LCD_WIDTH / 3,
.height = (LCD_HEIGHT / 2),
.font = FONT_UI,
.drawmode = DRMODE_SOLID,
.xmargin = 0,
.ymargin = 0,
#if LCD_DEPTH > 1
.fg_pattern = FGCOLOR_1,
.bg_pattern = BGCOLOR_2,
#ifdef HAVE_LCD_COLOR
.lss_pattern = LCD_DEFAULT_BG,
.lse_pattern = LCD_DEFAULT_BG,
.lst_pattern = LCD_DEFAULT_BG,
#endif
#endif
};
static struct viewport vp3 =
{
.x = LCD_WIDTH / 4,
.y = (5 * LCD_HEIGHT) / 8,
.width = LCD_WIDTH / 2,
.height = (LCD_HEIGHT / 4),
.font = FONT_SYSFIXED,
.drawmode = DRMODE_SOLID,
.xmargin = 0,
.ymargin = 0,
#if LCD_DEPTH > 1
.fg_pattern = LCD_BLACK,
.bg_pattern = LCD_WHITE,
#ifdef HAVE_LCD_COLOR
.lss_pattern = LCD_DEFAULT_BG,
.lse_pattern = LCD_DEFAULT_BG,
.lst_pattern = LCD_DEFAULT_BG,
#endif
#endif
};
#ifdef HAVE_REMOTE_LCD
static struct viewport rvp0 =
{
.x = 0,
.y = 10,
.width = LCD_REMOTE_WIDTH / 3,
.height = LCD_REMOTE_HEIGHT - 10,
.font = FONT_SYSFIXED,
.drawmode = DRMODE_SOLID,
.xmargin = 0,
.ymargin = 0,
#if LCD_REMOTE_DEPTH > 1
.fg_pattern = LCD_REMOTE_BLACK,
.bg_pattern = LCD_REMOTE_LIGHTGRAY,
#endif
};
static struct viewport rvp1 =
{
.x = LCD_REMOTE_WIDTH / 2,
.y = 0,
.width = LCD_REMOTE_WIDTH / 3,
.height = LCD_REMOTE_HEIGHT - 10,
.font = FONT_SYSFIXED,
.drawmode = DRMODE_SOLID,
.xmargin = 0,
.ymargin = 0,
#if LCD_REMOTE_DEPTH > 1
.fg_pattern = LCD_REMOTE_DEFAULT_FG,
.bg_pattern = LCD_REMOTE_DEFAULT_BG
#endif
};
#endif
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
(void)parameter;
char buf[80];
int i,y;
rb = api;
rb->screens[SCREEN_MAIN]->set_viewport(&vp0);
rb->screens[SCREEN_MAIN]->clear_viewport();
rb->screens[SCREEN_MAIN]->puts_scroll(0,0,"Viewport testing plugin - this is a scrolling title");
rb->screens[SCREEN_MAIN]->set_viewport(&vp1);
rb->screens[SCREEN_MAIN]->clear_viewport();
for (i = 0 ; i < 3; i++)
{
rb->snprintf(buf,sizeof(buf),"Left text, scrolling_line %d",i);
rb->screens[SCREEN_MAIN]->puts_scroll(0,i,buf);
}
rb->screens[SCREEN_MAIN]->set_viewport(&vp2);
rb->screens[SCREEN_MAIN]->clear_viewport();
for (i = 1 ; i < 3; i++)
{
rb->snprintf(buf,sizeof(buf),"Right text, scrolling line %d",i);
rb->screens[SCREEN_MAIN]->puts_scroll(1,i,buf);
}
y = -10;
for (i = -10; i < vp2.width + 10; i += 5)
{
rb->screens[SCREEN_MAIN]->drawline(i, y, i, vp2.height - y);
}
rb->screens[SCREEN_MAIN]->set_viewport(&vp3);
rb->screens[SCREEN_MAIN]->clear_viewport();
for (i = 1 ; i < 2; i++)
{
rb->snprintf(buf,sizeof(buf),"Bottom text, a scrolling line %d",i);
rb->screens[SCREEN_MAIN]->puts_scroll(2,i,buf);
}
rb->screens[SCREEN_MAIN]->puts_scroll(4,i,"Short line");
rb->screens[SCREEN_MAIN]->update();
#ifdef HAVE_REMOTE_LCD
rb->screens[SCREEN_REMOTE]->set_viewport(&rvp0);
rb->screens[SCREEN_REMOTE]->clear_viewport();
for (i = 0 ; i < 5; i++)
{
rb->snprintf(buf,sizeof(buf),"Left text, scrolling_line %d",i);
rb->screens[SCREEN_REMOTE]->puts_scroll(0,i,buf);
}
rb->screens[SCREEN_REMOTE]->puts(1,i,"Static");
rb->screens[SCREEN_REMOTE]->set_viewport(&rvp1);
rb->screens[SCREEN_REMOTE]->clear_viewport();
for (i = 1 ; i < 3; i++)
{
rb->snprintf(buf,sizeof(buf),"Right text, scrolling line %d",i);
rb->screens[SCREEN_REMOTE]->puts_scroll(1,i,buf);
}
y = -10;
for (i = -10; i < rvp1.width + 10; i += 5)
{
rb->screens[SCREEN_REMOTE]->drawline(i, y, i, rvp1.height - y);
}
rb->screens[SCREEN_REMOTE]->update();
#endif
rb->button_get(true);
/* Restore the default viewport */
rb->screens[SCREEN_MAIN]->set_viewport(NULL);
#ifdef HAVE_REMOTE_LCD
rb->screens[SCREEN_REMOTE]->set_viewport(NULL);
#endif
return PLUGIN_OK;
}
#else
/* Charcell version of plugin */
static struct viewport vp0 =
{
.x = 0,
.y = 0,
.width = 5,
.height = 1,
.xmargin = 0,
.ymargin = 0,
};
static struct viewport vp1 =
{
.x = 6,
.y = 0,
.width = 5,
.height = 1,
.xmargin = 0,
.ymargin = 0,
};
static struct viewport vp2 =
{
.x = 0,
.y = 1,
.width = LCD_WIDTH,
.height = 1,
.xmargin = 0,
.ymargin = 0,
};
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
(void)parameter;
rb = api;
rb->screens[SCREEN_MAIN]->set_viewport(&vp0);
rb->screens[SCREEN_MAIN]->clear_viewport();
rb->screens[SCREEN_MAIN]->puts_scroll(0,0,"Rockbox");
rb->screens[SCREEN_MAIN]->set_viewport(&vp1);
rb->screens[SCREEN_MAIN]->clear_viewport();
rb->screens[SCREEN_MAIN]->puts_scroll(0,0,"Viewports");
rb->screens[SCREEN_MAIN]->set_viewport(&vp2);
rb->screens[SCREEN_MAIN]->clear_viewport();
rb->screens[SCREEN_MAIN]->puts_scroll(0,0,"Demonstration");
rb->screens[SCREEN_MAIN]->update();
rb->button_get(true);
/* Restore the default viewport */
rb->screens[SCREEN_MAIN]->set_viewport(NULL);
return PLUGIN_OK;
}
#endif /* !HAVE_LCD_BITMAP */

View file

@ -19,6 +19,7 @@
#include <lcd.h> #include <lcd.h>
#include <lcd-remote.h> #include <lcd-remote.h>
#include <scroll_engine.h>
#include "backlight.h" #include "backlight.h"
#include <font.h> #include <font.h>
#include <button.h> #include <button.h>
@ -50,12 +51,16 @@ struct screen screens[NB_SCREENS] =
#elif defined(HAVE_REMOTE_LCD) #elif defined(HAVE_REMOTE_LCD)
.has_disk_led=true, .has_disk_led=true,
#endif #endif
.set_viewport=&lcd_set_viewport,
.setmargins=&lcd_setmargins, .setmargins=&lcd_setmargins,
.getwidth=&lcd_getwidth,
.getheight=&lcd_getheight,
.getymargin=&lcd_getymargin, .getymargin=&lcd_getymargin,
.getxmargin=&lcd_getxmargin, .getxmargin=&lcd_getxmargin,
.getstringsize=&lcd_getstringsize, .getstringsize=&lcd_getstringsize,
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
.setfont=&lcd_setfont, .setfont=&lcd_setfont,
.getfont=&lcd_getfont,
.mono_bitmap=&lcd_mono_bitmap, .mono_bitmap=&lcd_mono_bitmap,
.mono_bitmap_part=&lcd_mono_bitmap_part, .mono_bitmap_part=&lcd_mono_bitmap_part,
.set_drawmode=&lcd_set_drawmode, .set_drawmode=&lcd_set_drawmode,
@ -84,6 +89,7 @@ struct screen screens[NB_SCREENS] =
#endif #endif
#endif /* LCD_DEPTH > 1 */ #endif /* LCD_DEPTH > 1 */
.update_rect=&lcd_update_rect, .update_rect=&lcd_update_rect,
.update_viewport_rect=&lcd_update_viewport_rect,
.fillrect=&lcd_fillrect, .fillrect=&lcd_fillrect,
.drawrect=&lcd_drawrect, .drawrect=&lcd_drawrect,
.drawpixel=&lcd_drawpixel, .drawpixel=&lcd_drawpixel,
@ -114,7 +120,11 @@ struct screen screens[NB_SCREENS] =
.scroll_delay=&lcd_scroll_delay, .scroll_delay=&lcd_scroll_delay,
.stop_scroll=&lcd_stop_scroll, .stop_scroll=&lcd_stop_scroll,
.clear_display=&lcd_clear_display, .clear_display=&lcd_clear_display,
.clear_viewport=&lcd_clear_viewport,
.scroll_stop=&lcd_scroll_stop,
.scroll_stop_line=&lcd_scroll_stop_line,
.update=&lcd_update, .update=&lcd_update,
.update_viewport=&lcd_update_viewport,
.backlight_on=&backlight_on, .backlight_on=&backlight_on,
.backlight_off=&backlight_off, .backlight_off=&backlight_off,
.is_backlight_on=&is_backlight_on, .is_backlight_on=&is_backlight_on,
@ -132,12 +142,15 @@ struct screen screens[NB_SCREENS] =
.is_color=false,/* No color remotes yet */ .is_color=false,/* No color remotes yet */
.pixel_format=LCD_REMOTE_PIXELFORMAT, .pixel_format=LCD_REMOTE_PIXELFORMAT,
.has_disk_led=false, .has_disk_led=false,
.set_viewport=&lcd_remote_set_viewport,
.setmargins=&lcd_remote_setmargins, .setmargins=&lcd_remote_setmargins,
.getwidth=&lcd_remote_getwidth,
.getheight=&lcd_remote_getheight,
.getymargin=&lcd_remote_getymargin, .getymargin=&lcd_remote_getymargin,
.getxmargin=&lcd_remote_getxmargin, .getxmargin=&lcd_remote_getxmargin,
.getstringsize=&lcd_remote_getstringsize, .getstringsize=&lcd_remote_getstringsize,
#if 1 /* all remote LCDs are bitmapped so far */ #if 1 /* all remote LCDs are bitmapped so far */
.setfont=&lcd_remote_setfont, .getfont=&lcd_remote_getfont,
.mono_bitmap=&lcd_remote_mono_bitmap, .mono_bitmap=&lcd_remote_mono_bitmap,
.mono_bitmap_part=&lcd_remote_mono_bitmap_part, .mono_bitmap_part=&lcd_remote_mono_bitmap_part,
.bitmap=(screen_bitmap_func*)&lcd_remote_bitmap, .bitmap=(screen_bitmap_func*)&lcd_remote_bitmap,
@ -159,6 +172,7 @@ struct screen screens[NB_SCREENS] =
.set_foreground=&lcd_remote_set_foreground, .set_foreground=&lcd_remote_set_foreground,
#endif /* LCD_REMOTE_DEPTH > 1 */ #endif /* LCD_REMOTE_DEPTH > 1 */
.update_rect=&lcd_remote_update_rect, .update_rect=&lcd_remote_update_rect,
.update_viewport_rect=&lcd_remote_update_viewport_rect,
.fillrect=&lcd_remote_fillrect, .fillrect=&lcd_remote_fillrect,
.drawrect=&lcd_remote_drawrect, .drawrect=&lcd_remote_drawrect,
.drawpixel=&lcd_remote_drawpixel, .drawpixel=&lcd_remote_drawpixel,
@ -187,7 +201,11 @@ struct screen screens[NB_SCREENS] =
.scroll_delay=&lcd_remote_scroll_delay, .scroll_delay=&lcd_remote_scroll_delay,
.stop_scroll=&lcd_remote_stop_scroll, .stop_scroll=&lcd_remote_stop_scroll,
.clear_display=&lcd_remote_clear_display, .clear_display=&lcd_remote_clear_display,
.clear_viewport=&lcd_remote_clear_viewport,
.scroll_stop=&lcd_remote_scroll_stop,
.scroll_stop_line=&lcd_remote_scroll_stop_line,
.update=&lcd_remote_update, .update=&lcd_remote_update,
.update_viewport=&lcd_remote_update_viewport,
.backlight_on=&remote_backlight_on, .backlight_on=&remote_backlight_on,
.backlight_off=&remote_backlight_off, .backlight_off=&remote_backlight_off,
.is_backlight_on=&is_remote_backlight_on, .is_backlight_on=&is_remote_backlight_on,

View file

@ -71,12 +71,16 @@ struct screen
#ifdef HAS_BUTTONBAR #ifdef HAS_BUTTONBAR
bool has_buttonbar; bool has_buttonbar;
#endif #endif
void (*set_viewport)(struct viewport* vp);
void (*setmargins)(int x, int y); void (*setmargins)(int x, int y);
int (*getwidth)(void);
int (*getheight)(void);
int (*getxmargin)(void); int (*getxmargin)(void);
int (*getymargin)(void); int (*getymargin)(void);
int (*getstringsize)(const unsigned char *str, int *w, int *h); int (*getstringsize)(const unsigned char *str, int *w, int *h);
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */ #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
void (*setfont)(int newfont); void (*setfont)(int newfont);
int (*getfont)(void);
void (*scroll_step)(int pixels); void (*scroll_step)(int pixels);
void (*puts_style_offset)(int x, int y, const unsigned char *str, void (*puts_style_offset)(int x, int y, const unsigned char *str,
@ -113,6 +117,7 @@ struct screen
void (*set_selector_text)(unsigned selector_text); void (*set_selector_text)(unsigned selector_text);
#endif #endif
void (*update_rect)(int x, int y, int width, int height); void (*update_rect)(int x, int y, int width, int height);
void (*update_viewport_rect)(int x, int y, int width, int height);
void (*fillrect)(int x, int y, int width, int height); void (*fillrect)(int x, int y, int width, int height);
void (*drawrect)(int x, int y, int width, int height); void (*drawrect)(int x, int y, int width, int height);
void (*drawpixel)(int x, int y); void (*drawpixel)(int x, int y);
@ -139,7 +144,11 @@ struct screen
void (*scroll_delay)(int ms); void (*scroll_delay)(int ms);
void (*stop_scroll)(void); void (*stop_scroll)(void);
void (*clear_display)(void); void (*clear_display)(void);
void (*clear_viewport)(void);
void (*scroll_stop)(struct viewport* vp);
void (*scroll_stop_line)(struct viewport* vp, int y);
void (*update)(void); void (*update)(void);
void (*update_viewport)(void);
void (*backlight_on)(void); void (*backlight_on)(void);
void (*backlight_off)(void); void (*backlight_off)(void);
bool (*is_backlight_on)(void); bool (*is_backlight_on)(void);

View file

@ -190,6 +190,11 @@ void lcd_setfont(int newfont)
current_vp->font = newfont; current_vp->font = newfont;
} }
int lcd_getfont(void)
{
return current_vp->font;
}
int lcd_getstringsize(const unsigned char *str, int *w, int *h) int lcd_getstringsize(const unsigned char *str, int *w, int *h)
{ {
return font_getstringsize(str, w, h, current_vp->font); return font_getstringsize(str, w, h, current_vp->font);

View file

@ -122,6 +122,11 @@ void lcd_setfont(int newfont)
current_vp->font = newfont; current_vp->font = newfont;
} }
int lcd_getfont(void)
{
return current_vp->font;
}
int lcd_getstringsize(const unsigned char *str, int *w, int *h) int lcd_getstringsize(const unsigned char *str, int *w, int *h)
{ {
return font_getstringsize(str, w, h, current_vp->font); return font_getstringsize(str, w, h, current_vp->font);

View file

@ -172,6 +172,11 @@ void lcd_setfont(int newfont)
current_vp->font = newfont; current_vp->font = newfont;
} }
int lcd_getfont(void)
{
return current_vp->font;
}
int lcd_getstringsize(const unsigned char *str, int *w, int *h) int lcd_getstringsize(const unsigned char *str, int *w, int *h)
{ {
return font_getstringsize(str, w, h, current_vp->font); return font_getstringsize(str, w, h, current_vp->font);

View file

@ -175,6 +175,11 @@ void lcd_setfont(int newfont)
current_vp->font = newfont; current_vp->font = newfont;
} }
int lcd_getfont(void)
{
return current_vp->font;
}
int lcd_getstringsize(const unsigned char *str, int *w, int *h) int lcd_getstringsize(const unsigned char *str, int *w, int *h)
{ {
return font_getstringsize(str, w, h, current_vp->font); return font_getstringsize(str, w, h, current_vp->font);

View file

@ -117,6 +117,11 @@ void lcd_remote_setfont(int newfont)
current_vp->font = newfont; current_vp->font = newfont;
} }
int lcd_remote_getfont(void)
{
return current_vp->font;
}
int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h) int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h)
{ {
return font_getstringsize(str, w, h, current_vp->font); return font_getstringsize(str, w, h, current_vp->font);

View file

@ -174,6 +174,11 @@ void lcd_remote_setfont(int newfont)
current_vp->font = newfont; current_vp->font = newfont;
} }
int lcd_remote_getfont(void)
{
return current_vp->font;
}
int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h) int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h)
{ {
return font_getstringsize(str, w, h, current_vp->font); return font_getstringsize(str, w, h, current_vp->font);

View file

@ -149,6 +149,7 @@ extern int lcd_remote_getymargin(void);
extern int lcd_remote_getwidth(void); extern int lcd_remote_getwidth(void);
extern int lcd_remote_getheight(void); extern int lcd_remote_getheight(void);
extern void lcd_remote_setfont(int font); extern void lcd_remote_setfont(int font);
extern int lcd_remote_getfont(void);
extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h); extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h);
/* low level drawing function pointer arrays */ /* low level drawing function pointer arrays */

View file

@ -372,6 +372,7 @@ extern void lcd_set_flip(bool yesno);
extern void lcd_set_drawmode(int mode); extern void lcd_set_drawmode(int mode);
extern int lcd_get_drawmode(void); extern int lcd_get_drawmode(void);
extern void lcd_setfont(int font); extern void lcd_setfont(int font);
extern int lcd_getfont(void);
extern void lcd_puts_style_offset(int x, int y, const unsigned char *str, extern void lcd_puts_style_offset(int x, int y, const unsigned char *str,
int style, int offset); int style, int offset);