icons: Remove automatic left padding if x == 0.

Since x is viewport-relative the icon isn't necessarily placed at the physical
display boundaries so that the padding isn't always useful. In fact it does
more harm if one wants to place an icon exactly at 0 of a (non-default)
viewport.

Calling code looks still mostly fine. I've only modified list drawer to include
the padding in the call-site.

Change-Id: I6b16b3d4377c3553234667b79837adde10e0edf2
This commit is contained in:
Thomas Martitz 2013-12-20 23:34:28 +01:00
parent 76476751d7
commit bc9a45b05f
2 changed files with 3 additions and 6 deletions

View file

@ -124,7 +124,7 @@ static bool draw_title(struct screen *display, struct gui_synclist *list)
title_text_vp->width -= title_icon.width;
display->set_viewport(&title_icon);
screen_put_iconxy(display, 0, 0, list->title_icon);
screen_put_iconxy(display, ICON_PADDING, 0, list->title_icon);
}
#ifdef HAVE_LCD_COLOR
if (list->title_color >= 0)
@ -368,7 +368,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
display->set_viewport(&list_icons);
if (list->callback_get_item_icon != NULL)
{
int xoff = show_cursor ? list_icon_width(screen) : 0;
int xoff = show_cursor ? list_icon_width(screen) : ICON_PADDING;
screen_put_iconxy(display, xoff,
line*line_height + draw_offset + icon_yoffset,
list->callback_get_item_icon(i, list->data));
@ -377,7 +377,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
if (show_cursor && i >= list->selected_item &&
i < list->selected_item + list->selected_size)
{
screen_put_iconxy(display, 0,
screen_put_iconxy(display, ICON_PADDING,
line*line_height + draw_offset + icon_yoffset,
Icon_Cursor);
}

View file

@ -134,9 +134,6 @@ void screen_put_iconxy(struct screen * display,
{
iconset = inbuilt_iconset[screen];
}
/* add some left padding to the icons if they are on the edge */
if (xpos == 0)
xpos++;
if (is_rtl)
xpos = display->getwidth() - xpos - width;