forked from len0rd/rockbox
Reorder a bit in viewport.c so that we don't need stubs for checkwps.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23511 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
de45edbdb1
commit
6750d65f79
2 changed files with 90 additions and 105 deletions
|
|
@ -38,6 +38,8 @@
|
||||||
#define BG_FALLBACK LCD_DEFAULT_BG
|
#define BG_FALLBACK LCD_DEFAULT_BG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void set_default_align_flags(struct viewport *vp);
|
||||||
|
|
||||||
/* all below isn't needed for pc tools (i.e. checkwps/wps editor)
|
/* all below isn't needed for pc tools (i.e. checkwps/wps editor)
|
||||||
* only viewport_parse_viewport() is */
|
* only viewport_parse_viewport() is */
|
||||||
#ifndef __PCTOOL__
|
#ifndef __PCTOOL__
|
||||||
|
|
@ -57,8 +59,6 @@
|
||||||
static int statusbar_enabled = 0;
|
static int statusbar_enabled = 0;
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
static void set_default_align_flags(struct viewport *vp);
|
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
struct viewport* vp;
|
struct viewport* vp;
|
||||||
int active[NB_SCREENS];
|
int active[NB_SCREENS];
|
||||||
|
|
@ -98,91 +98,6 @@ static bool showing_bars(enum screen_type screen)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewport_set_fullscreen(struct viewport *vp,
|
|
||||||
const enum screen_type screen)
|
|
||||||
{
|
|
||||||
vp->x = 0;
|
|
||||||
vp->y = 0;
|
|
||||||
vp->width = screens[screen].lcdwidth;
|
|
||||||
vp->height = screens[screen].lcdheight;
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
set_default_align_flags(vp);
|
|
||||||
vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */
|
|
||||||
vp->drawmode = DRMODE_SOLID;
|
|
||||||
#if LCD_DEPTH > 1
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
|
||||||
/* We only need this test if there is a remote LCD */
|
|
||||||
if (screen == SCREEN_MAIN)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
vp->fg_pattern = FG_FALLBACK;
|
|
||||||
vp->bg_pattern = BG_FALLBACK;
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
|
||||||
vp->lss_pattern = global_settings.lss_color;
|
|
||||||
vp->lse_pattern = global_settings.lse_color;
|
|
||||||
vp->lst_pattern = global_settings.lst_color;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
|
||||||
if (screen == SCREEN_REMOTE)
|
|
||||||
{
|
|
||||||
vp->fg_pattern = LCD_REMOTE_DEFAULT_FG;
|
|
||||||
vp->bg_pattern = LCD_REMOTE_DEFAULT_BG;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void viewport_set_defaults(struct viewport *vp,
|
|
||||||
const enum screen_type screen)
|
|
||||||
{
|
|
||||||
/* Reposition:
|
|
||||||
1) If the "ui viewport" setting is set, and a sbs is loaded which specifies a %Vi
|
|
||||||
return the intersection of those two viewports
|
|
||||||
2) If only one of the "ui viewport" setting, or sbs %Vi is set
|
|
||||||
return it
|
|
||||||
3) No user viewports set
|
|
||||||
return the full display
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
|
|
||||||
struct viewport *sbs_area = NULL, *user_setting = NULL;
|
|
||||||
/* get the two viewports */
|
|
||||||
if (ui_vp_info.active[screen])
|
|
||||||
user_setting = &ui_vp_info.vp[screen];
|
|
||||||
if (sb_skin_get_state(screen))
|
|
||||||
sbs_area = sb_skin_get_info_vp(screen);
|
|
||||||
/* have both? get their intersection */
|
|
||||||
if (sbs_area && user_setting)
|
|
||||||
{
|
|
||||||
struct viewport *a = sbs_area, *b = user_setting;
|
|
||||||
/* make sure they do actually overlap,
|
|
||||||
* if they dont its user error, so use the full display
|
|
||||||
* and live with redraw problems */
|
|
||||||
if (a->x < b->x + b->width &&
|
|
||||||
a->x + a->width > b->x &&
|
|
||||||
a->y < b->y + b->height &&
|
|
||||||
a->y + a->height > b->y)
|
|
||||||
{
|
|
||||||
vp->x = MAX(a->x, b->x);
|
|
||||||
vp->y = MAX(a->y, b->y);
|
|
||||||
vp->width = MIN(a->x + a->width, b->x + b->width) - vp->x;
|
|
||||||
vp->height = MIN(a->y + a->height, b->y + b->height) - vp->y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* only one so use it */
|
|
||||||
else if (sbs_area)
|
|
||||||
*vp = *sbs_area;
|
|
||||||
else if (user_setting)
|
|
||||||
*vp = *user_setting;
|
|
||||||
/* have neither so its fullscreen which was fixed at the beginning */
|
|
||||||
else
|
|
||||||
#endif /* HAVE_LCD_BITMAP */
|
|
||||||
viewport_set_fullscreen(vp, screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
void viewportmanager_init(void)
|
void viewportmanager_init(void)
|
||||||
{
|
{
|
||||||
|
|
@ -400,6 +315,94 @@ bool viewport_point_within_vp(const struct viewport *vp,
|
||||||
#define ARG_STRING(_depth) "dddddgg"
|
#define ARG_STRING(_depth) "dddddgg"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void viewport_set_fullscreen(struct viewport *vp,
|
||||||
|
const enum screen_type screen)
|
||||||
|
{
|
||||||
|
vp->x = 0;
|
||||||
|
vp->y = 0;
|
||||||
|
vp->width = screens[screen].lcdwidth;
|
||||||
|
vp->height = screens[screen].lcdheight;
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
set_default_align_flags(vp);
|
||||||
|
vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */
|
||||||
|
vp->drawmode = DRMODE_SOLID;
|
||||||
|
#if LCD_DEPTH > 1
|
||||||
|
#ifdef HAVE_REMOTE_LCD
|
||||||
|
/* We only need this test if there is a remote LCD */
|
||||||
|
if (screen == SCREEN_MAIN)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
vp->fg_pattern = FG_FALLBACK;
|
||||||
|
vp->bg_pattern = BG_FALLBACK;
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
vp->lss_pattern = global_settings.lss_color;
|
||||||
|
vp->lse_pattern = global_settings.lse_color;
|
||||||
|
vp->lst_pattern = global_settings.lst_color;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||||
|
if (screen == SCREEN_REMOTE)
|
||||||
|
{
|
||||||
|
vp->fg_pattern = LCD_REMOTE_DEFAULT_FG;
|
||||||
|
vp->bg_pattern = LCD_REMOTE_DEFAULT_BG;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void viewport_set_defaults(struct viewport *vp,
|
||||||
|
const enum screen_type screen)
|
||||||
|
{
|
||||||
|
/* Reposition:
|
||||||
|
1) If the "ui viewport" setting is set, and a sbs is loaded which specifies a %Vi
|
||||||
|
return the intersection of those two viewports
|
||||||
|
2) If only one of the "ui viewport" setting, or sbs %Vi is set
|
||||||
|
return it
|
||||||
|
3) No user viewports set
|
||||||
|
return the full display
|
||||||
|
*/
|
||||||
|
#if defined(HAVE_LCD_BITMAP) && !defined(__PCTOOL__)
|
||||||
|
|
||||||
|
struct viewport *sbs_area = NULL, *user_setting = NULL;
|
||||||
|
/* get the two viewports */
|
||||||
|
if (ui_vp_info.active[screen])
|
||||||
|
user_setting = &ui_vp_info.vp[screen];
|
||||||
|
if (sb_skin_get_state(screen))
|
||||||
|
sbs_area = sb_skin_get_info_vp(screen);
|
||||||
|
/* have both? get their intersection */
|
||||||
|
if (sbs_area && user_setting)
|
||||||
|
{
|
||||||
|
struct viewport *a = sbs_area, *b = user_setting;
|
||||||
|
/* make sure they do actually overlap,
|
||||||
|
* if they dont its user error, so use the full display
|
||||||
|
* and live with redraw problems */
|
||||||
|
if (a->x < b->x + b->width &&
|
||||||
|
a->x + a->width > b->x &&
|
||||||
|
a->y < b->y + b->height &&
|
||||||
|
a->y + a->height > b->y)
|
||||||
|
{
|
||||||
|
vp->x = MAX(a->x, b->x);
|
||||||
|
vp->y = MAX(a->y, b->y);
|
||||||
|
vp->width = MIN(a->x + a->width, b->x + b->width) - vp->x;
|
||||||
|
vp->height = MIN(a->y + a->height, b->y + b->height) - vp->y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* only one so use it */
|
||||||
|
else if (sbs_area)
|
||||||
|
*vp = *sbs_area;
|
||||||
|
else if (user_setting)
|
||||||
|
*vp = *user_setting;
|
||||||
|
/* have neither so its fullscreen which was fixed at the beginning */
|
||||||
|
else
|
||||||
|
#endif /* HAVE_LCD_BITMAP */
|
||||||
|
viewport_set_fullscreen(vp, screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
|
||||||
static void set_default_align_flags(struct viewport *vp)
|
static void set_default_align_flags(struct viewport *vp)
|
||||||
|
|
|
||||||
|
|
@ -231,24 +231,6 @@ void screen_clear_area(struct screen * display, int xstart, int ystart,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* reimplement some simple stuff from viewport.c which doesnt change the skins
|
|
||||||
validity even if the values are not correct */
|
|
||||||
void viewport_set_fullscreen(struct viewport *vp,
|
|
||||||
const enum screen_type screen)
|
|
||||||
{
|
|
||||||
vp->x = 0;
|
|
||||||
vp->y = 0;
|
|
||||||
vp->width = screens[screen].lcdwidth;
|
|
||||||
vp->height = screens[screen].lcdheight;
|
|
||||||
}
|
|
||||||
|
|
||||||
void viewport_set_defaults(struct viewport *vp,
|
|
||||||
const enum screen_type screen)
|
|
||||||
{
|
|
||||||
viewport_set_fullscreen(vp, screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue