forked from len0rd/rockbox
reduce ramusage slightly.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28355 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
462f012d17
commit
0952848368
1 changed files with 27 additions and 36 deletions
|
@ -52,25 +52,19 @@
|
||||||
/* We dont actually do anything with these pointers,
|
/* We dont actually do anything with these pointers,
|
||||||
but they need to be grouped like this to save code
|
but they need to be grouped like this to save code
|
||||||
so storing them as void* is ok. (stops compile warning) */
|
so storing them as void* is ok. (stops compile warning) */
|
||||||
static const void * inbuilt_icons[NB_SCREENS] = {
|
static const struct bitmap inbuilt_iconset[NB_SCREENS] =
|
||||||
(void*)default_icons
|
{
|
||||||
|
{
|
||||||
|
.width = BMPWIDTH_default_icons,
|
||||||
|
.height = BMPHEIGHT_default_icons,
|
||||||
|
.data = (unsigned char*)default_icons,
|
||||||
|
},
|
||||||
#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
|
#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
|
||||||
, (void*)remote_default_icons
|
{
|
||||||
#endif
|
.width = BMPWIDTH_remote_default_icons,
|
||||||
};
|
.height = BMPHEIGHT_remote_default_icons,
|
||||||
|
.data = (unsigned char*)remote_default_icons,
|
||||||
static const int default_width[NB_SCREENS] = {
|
},
|
||||||
BMPWIDTH_default_icons
|
|
||||||
#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
|
|
||||||
, BMPWIDTH_remote_default_icons
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
/* height of whole file */
|
|
||||||
static const int default_height[NB_SCREENS] = {
|
|
||||||
BMPHEIGHT_default_icons
|
|
||||||
#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
|
|
||||||
, BMPHEIGHT_remote_default_icons
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,14 +80,12 @@ static struct bitmap viewer_iconset[NB_SCREENS];
|
||||||
|
|
||||||
|
|
||||||
#define ICON_HEIGHT(screen) (!custom_icons_loaded[screen]? \
|
#define ICON_HEIGHT(screen) (!custom_icons_loaded[screen]? \
|
||||||
default_height[screen] : \
|
inbuilt_iconset : user_iconset)[screen].height \
|
||||||
user_iconset[screen].height) \
|
|
||||||
/ Icon_Last_Themeable
|
/ Icon_Last_Themeable
|
||||||
|
|
||||||
#define ICON_WIDTH(screen) (!custom_icons_loaded[screen]? \
|
#define ICON_WIDTH(screen) (!custom_icons_loaded[screen]? \
|
||||||
default_width[screen] : \
|
inbuilt_iconset : user_iconset)[screen].width
|
||||||
user_iconset[screen].width)
|
|
||||||
|
|
||||||
/* x,y in letters, not pixles */
|
/* x,y in letters, not pixles */
|
||||||
void screen_put_icon(struct screen * display,
|
void screen_put_icon(struct screen * display,
|
||||||
int x, int y, enum themable_icons icon)
|
int x, int y, enum themable_icons icon)
|
||||||
|
@ -105,15 +97,17 @@ void screen_put_icon_with_offset(struct screen * display,
|
||||||
int x, int y, int off_x, int off_y,
|
int x, int y, int off_x, int off_y,
|
||||||
enum themable_icons icon)
|
enum themable_icons icon)
|
||||||
{
|
{
|
||||||
|
const int screen = display->screen_type;
|
||||||
|
const int icon_width = ICON_WIDTH(screen);
|
||||||
|
const int icon_height = ICON_HEIGHT(screen);
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
int width, height;
|
int width, height;
|
||||||
int screen = display->screen_type;
|
|
||||||
display->getstringsize((unsigned char *)"M", &width, &height);
|
display->getstringsize((unsigned char *)"M", &width, &height);
|
||||||
xpos = x*ICON_WIDTH(screen) + off_x;
|
xpos = x*icon_width + off_x;
|
||||||
ypos = y*height + off_y;
|
ypos = y*height + off_y;
|
||||||
|
|
||||||
if ( height > ICON_HEIGHT(screen) )/* center the cursor */
|
if ( height > icon_height )/* center the cursor */
|
||||||
ypos += (height - ICON_HEIGHT(screen)) / 2;
|
ypos += (height - icon_height) / 2;
|
||||||
screen_put_iconxy(display, xpos, ypos, icon);
|
screen_put_iconxy(display, xpos, ypos, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,21 +142,18 @@ void screen_put_iconxy(struct screen * display,
|
||||||
screen_put_iconxy(display, xpos, ypos, Icon_Questionmark);
|
screen_put_iconxy(display, xpos, ypos, Icon_Questionmark);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data = iconset->data;
|
|
||||||
stride = STRIDE(display->screen_type, iconset->width, iconset->height);
|
|
||||||
}
|
}
|
||||||
else if (custom_icons_loaded[screen])
|
else if (custom_icons_loaded[screen])
|
||||||
{
|
{
|
||||||
iconset = &user_iconset[screen];
|
iconset = &user_iconset[screen];
|
||||||
data = iconset->data;
|
|
||||||
stride = STRIDE(display->screen_type, iconset->width, iconset->height);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data = inbuilt_icons[screen];
|
iconset = &inbuilt_iconset[screen];
|
||||||
stride = STRIDE( display->screen_type, BMPWIDTH_default_icons,
|
|
||||||
BMPHEIGHT_default_icons);
|
|
||||||
}
|
}
|
||||||
|
data = iconset->data;
|
||||||
|
stride = STRIDE(display->screen_type, iconset->width, iconset->height);
|
||||||
|
|
||||||
/* add some left padding to the icons if they are on the edge */
|
/* add some left padding to the icons if they are on the edge */
|
||||||
if (xpos == 0)
|
if (xpos == 0)
|
||||||
xpos++;
|
xpos++;
|
||||||
|
@ -187,8 +178,8 @@ void screen_put_cursorxy(struct screen * display, int x, int y, bool on)
|
||||||
#else
|
#else
|
||||||
screen_put_icon(display, x, y, on?CURSOR_CHAR:-1);
|
screen_put_icon(display, x, y, on?CURSOR_CHAR:-1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Iconset {
|
enum Iconset {
|
||||||
Iconset_Mainscreen,
|
Iconset_Mainscreen,
|
||||||
Iconset_Mainscreen_viewers,
|
Iconset_Mainscreen_viewers,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue