summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/skin_engine/skin_parser.c60
-rw-r--r--apps/gui/skin_engine/wps_internals.h14
-rw-r--r--apps/gui/wps.c6
-rw-r--r--apps/recorder/albumart.c28
4 files changed, 54 insertions, 54 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index b03bdb013d..efe9f5228a 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -968,10 +968,10 @@ static int parse_albumart_load(const char *wps_bufptr,
968 return skip_end_of_line(wps_bufptr); 968 return skip_end_of_line(wps_bufptr);
969 969
970 /* reset albumart info in wps */ 970 /* reset albumart info in wps */
971 aa->albumart_max_width = -1; 971 aa->width = -1;
972 aa->albumart_max_height = -1; 972 aa->height = -1;
973 aa->albumart_xalign = WPS_ALBUMART_ALIGN_CENTER; /* default */ 973 aa->xalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
974 aa->albumart_yalign = WPS_ALBUMART_ALIGN_CENTER; /* default */ 974 aa->yalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
975 aa->vp = &curr_vp->vp; 975 aa->vp = &curr_vp->vp;
976 976
977 /* format: %Cl|x|y|[[l|c|r]mwidth]|[[t|c|b]mheight]| */ 977 /* format: %Cl|x|y|[[l|c|r]mwidth]|[[t|c|b]mheight]| */
@@ -983,7 +983,7 @@ static int parse_albumart_load(const char *wps_bufptr,
983 return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl7 */ 983 return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl7 */
984 984
985 _pos = wps_bufptr + 1; 985 _pos = wps_bufptr + 1;
986 _pos = parse_list("dd", NULL, '|', _pos, &aa->albumart_x, &aa->albumart_y); 986 _pos = parse_list("dd", NULL, '|', _pos, &aa->x, &aa->y);
987 987
988 if (!_pos || _pos > newline || *_pos != '|') 988 if (!_pos || _pos > newline || *_pos != '|')
989 return WPS_ERROR_INVALID_PARAM; /* malformed token: no | after y coordinate 989 return WPS_ERROR_INVALID_PARAM; /* malformed token: no | after y coordinate
@@ -1000,16 +1000,16 @@ static int parse_albumart_load(const char *wps_bufptr,
1000 case 'l': 1000 case 'l':
1001 case 'L': 1001 case 'L':
1002 case '+': 1002 case '+':
1003 aa->albumart_xalign = WPS_ALBUMART_ALIGN_LEFT; 1003 aa->xalign = WPS_ALBUMART_ALIGN_LEFT;
1004 break; 1004 break;
1005 case 'c': 1005 case 'c':
1006 case 'C': 1006 case 'C':
1007 aa->albumart_xalign = WPS_ALBUMART_ALIGN_CENTER; 1007 aa->xalign = WPS_ALBUMART_ALIGN_CENTER;
1008 break; 1008 break;
1009 case 'r': 1009 case 'r':
1010 case 'R': 1010 case 'R':
1011 case '-': 1011 case '-':
1012 aa->albumart_xalign = WPS_ALBUMART_ALIGN_RIGHT; 1012 aa->xalign = WPS_ALBUMART_ALIGN_RIGHT;
1013 break; 1013 break;
1014 case 'd': 1014 case 'd':
1015 case 'D': 1015 case 'D':
@@ -1030,7 +1030,7 @@ static int parse_albumart_load(const char *wps_bufptr,
1030 if (!isdigit(*_pos)) /* malformed token: e.g. %Cl|7|59|# */ 1030 if (!isdigit(*_pos)) /* malformed token: e.g. %Cl|7|59|# */
1031 return WPS_ERROR_INVALID_PARAM; 1031 return WPS_ERROR_INVALID_PARAM;
1032 1032
1033 aa->albumart_max_width = atoi(_pos); 1033 aa->width = atoi(_pos);
1034 1034
1035 _pos = strchr(_pos, '|'); 1035 _pos = strchr(_pos, '|');
1036 if (!_pos || _pos > newline) 1036 if (!_pos || _pos > newline)
@@ -1049,16 +1049,16 @@ static int parse_albumart_load(const char *wps_bufptr,
1049 case 't': 1049 case 't':
1050 case 'T': 1050 case 'T':
1051 case '-': 1051 case '-':
1052 aa->albumart_yalign = WPS_ALBUMART_ALIGN_TOP; 1052 aa->yalign = WPS_ALBUMART_ALIGN_TOP;
1053 break; 1053 break;
1054 case 'c': 1054 case 'c':
1055 case 'C': 1055 case 'C':
1056 aa->albumart_yalign = WPS_ALBUMART_ALIGN_CENTER; 1056 aa->yalign = WPS_ALBUMART_ALIGN_CENTER;
1057 break; 1057 break;
1058 case 'b': 1058 case 'b':
1059 case 'B': 1059 case 'B':
1060 case '+': 1060 case '+':
1061 aa->albumart_yalign = WPS_ALBUMART_ALIGN_BOTTOM; 1061 aa->yalign = WPS_ALBUMART_ALIGN_BOTTOM;
1062 break; 1062 break;
1063 case 'd': 1063 case 'd':
1064 case 'D': 1064 case 'D':
@@ -1079,7 +1079,7 @@ static int parse_albumart_load(const char *wps_bufptr,
1079 if (!isdigit(*_pos)) 1079 if (!isdigit(*_pos))
1080 return WPS_ERROR_INVALID_PARAM; /* malformed token e.g. %Cl|7|59|200|@ */ 1080 return WPS_ERROR_INVALID_PARAM; /* malformed token e.g. %Cl|7|59|200|@ */
1081 1081
1082 aa->albumart_max_height = atoi(_pos); 1082 aa->height = atoi(_pos);
1083 1083
1084 _pos = strchr(_pos, '|'); 1084 _pos = strchr(_pos, '|');
1085 if (!_pos || _pos > newline) 1085 if (!_pos || _pos > newline)
@@ -1088,17 +1088,17 @@ static int parse_albumart_load(const char *wps_bufptr,
1088 } 1088 }
1089 1089
1090 /* if we got here, we parsed everything ok .. ! */ 1090 /* if we got here, we parsed everything ok .. ! */
1091 if (aa->albumart_max_width < 0) 1091 if (aa->width < 0)
1092 aa->albumart_max_width = 0; 1092 aa->width = 0;
1093 else if (aa->albumart_max_width > LCD_WIDTH) 1093 else if (aa->width > LCD_WIDTH)
1094 aa->albumart_max_width = LCD_WIDTH; 1094 aa->width = LCD_WIDTH;
1095 1095
1096 if (aa->albumart_max_height < 0) 1096 if (aa->height < 0)
1097 aa->albumart_max_height = 0; 1097 aa->height = 0;
1098 else if (aa->albumart_max_height > LCD_HEIGHT) 1098 else if (aa->height > LCD_HEIGHT)
1099 aa->albumart_max_height = LCD_HEIGHT; 1099 aa->height = LCD_HEIGHT;
1100 1100
1101 aa->wps_uses_albumart = WPS_ALBUMART_LOAD; 1101 aa->state = WPS_ALBUMART_LOAD;
1102 aa->draw = false; 1102 aa->draw = false;
1103 wps_data->albumart = aa; 1103 wps_data->albumart = aa;
1104 1104
@@ -1671,12 +1671,12 @@ bool skin_data_load(struct wps_data *wps_data,
1671 int status; 1671 int status;
1672 struct mp3entry *curtrack; 1672 struct mp3entry *curtrack;
1673 long offset; 1673 long offset;
1674 struct skin_albumart old_aa = {.wps_uses_albumart = WPS_ALBUMART_NONE}; 1674 struct skin_albumart old_aa = {.state = WPS_ALBUMART_NONE};
1675 if (wps_data->albumart) 1675 if (wps_data->albumart)
1676 { 1676 {
1677 old_aa.wps_uses_albumart = wps_data->albumart->wps_uses_albumart; 1677 old_aa.state = wps_data->albumart->state;
1678 old_aa.albumart_max_height = wps_data->albumart->albumart_max_height; 1678 old_aa.height = wps_data->albumart->height;
1679 old_aa.albumart_max_width = wps_data->albumart->albumart_max_width; 1679 old_aa.width = wps_data->albumart->width;
1680 } 1680 }
1681#endif 1681#endif
1682 1682
@@ -1796,10 +1796,10 @@ bool skin_data_load(struct wps_data *wps_data,
1796 if (status & AUDIO_STATUS_PLAY) 1796 if (status & AUDIO_STATUS_PLAY)
1797 { 1797 {
1798 struct skin_albumart *aa = wps_data->albumart; 1798 struct skin_albumart *aa = wps_data->albumart;
1799 if (aa && ((aa->wps_uses_albumart && !old_aa.wps_uses_albumart) || 1799 if (aa && ((aa->state && !old_aa.state) ||
1800 (aa->wps_uses_albumart && 1800 (aa->state &&
1801 (((old_aa.albumart_max_height != aa->albumart_max_height) || 1801 (((old_aa.height != aa->height) ||
1802 (old_aa.albumart_max_width != aa->albumart_max_width)))))) 1802 (old_aa.width != aa->width))))))
1803 { 1803 {
1804 curtrack = audio_current_track(); 1804 curtrack = audio_current_track();
1805 offset = curtrack->offset; 1805 offset = curtrack->offset;
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index a5fc70d1ef..177a376008 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -226,15 +226,15 @@ struct touchregion {
226struct skin_albumart { 226struct skin_albumart {
227 /* Album art support */ 227 /* Album art support */
228 struct viewport *vp;/* The viewport this is in */ 228 struct viewport *vp;/* The viewport this is in */
229 int albumart_x; 229 int x;
230 int albumart_y; 230 int y;
231 int albumart_max_width; 231 int width;
232 int albumart_max_height; 232 int height;
233 233
234 bool draw; 234 bool draw;
235 unsigned char albumart_xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */ 235 unsigned char xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */
236 unsigned char albumart_yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */ 236 unsigned char yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */
237 unsigned char wps_uses_albumart; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */ 237 unsigned char state; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */
238}; 238};
239#endif 239#endif
240 240
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 1f585fcbff..2529686e3e 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -1317,12 +1317,12 @@ bool wps_uses_albumart(int *width, int *height)
1317 FOR_NB_SCREENS(i) { 1317 FOR_NB_SCREENS(i) {
1318 struct gui_wps *gwps = &gui_wps[i]; 1318 struct gui_wps *gwps = &gui_wps[i];
1319 struct skin_albumart *aa = gwps->data->albumart; 1319 struct skin_albumart *aa = gwps->data->albumart;
1320 if (aa && (aa->wps_uses_albumart != WPS_ALBUMART_NONE)) 1320 if (aa && (aa->state != WPS_ALBUMART_NONE))
1321 { 1321 {
1322 if (width) 1322 if (width)
1323 *width = aa->albumart_max_width; 1323 *width = aa->width;
1324 if (height) 1324 if (height)
1325 *height = aa->albumart_max_height; 1325 *height = aa->height;
1326 return true; 1326 return true;
1327 } 1327 }
1328 } 1328 }
diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c
index 7715287d46..bb2fae4af7 100644
--- a/apps/recorder/albumart.c
+++ b/apps/recorder/albumart.c
@@ -323,33 +323,33 @@ void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear)
323 if (bufgetdata(handle_id, 0, (void *)&bmp) <= 0) 323 if (bufgetdata(handle_id, 0, (void *)&bmp) <= 0)
324 return; 324 return;
325 325
326 short x = aa->albumart_x; 326 short x = aa->x;
327 short y = aa->albumart_y; 327 short y = aa->y;
328 short width = bmp->width; 328 short width = bmp->width;
329 short height = bmp->height; 329 short height = bmp->height;
330 330
331 if (aa->albumart_max_width > 0) 331 if (aa->width > 0)
332 { 332 {
333 /* Crop if the bitmap is too wide */ 333 /* Crop if the bitmap is too wide */
334 width = MIN(bmp->width, aa->albumart_max_width); 334 width = MIN(bmp->width, aa->width);
335 335
336 /* Align */ 336 /* Align */
337 if (aa->albumart_xalign & WPS_ALBUMART_ALIGN_RIGHT) 337 if (aa->xalign & WPS_ALBUMART_ALIGN_RIGHT)
338 x += aa->albumart_max_width - width; 338 x += aa->width - width;
339 else if (aa->albumart_xalign & WPS_ALBUMART_ALIGN_CENTER) 339 else if (aa->xalign & WPS_ALBUMART_ALIGN_CENTER)
340 x += (aa->albumart_max_width - width) / 2; 340 x += (aa->width - width) / 2;
341 } 341 }
342 342
343 if (aa->albumart_max_height > 0) 343 if (aa->height > 0)
344 { 344 {
345 /* Crop if the bitmap is too high */ 345 /* Crop if the bitmap is too high */
346 height = MIN(bmp->height, aa->albumart_max_height); 346 height = MIN(bmp->height, aa->height);
347 347
348 /* Align */ 348 /* Align */
349 if (aa->albumart_yalign & WPS_ALBUMART_ALIGN_BOTTOM) 349 if (aa->yalign & WPS_ALBUMART_ALIGN_BOTTOM)
350 y += aa->albumart_max_height - height; 350 y += aa->height - height;
351 else if (aa->albumart_yalign & WPS_ALBUMART_ALIGN_CENTER) 351 else if (aa->yalign & WPS_ALBUMART_ALIGN_CENTER)
352 y += (aa->albumart_max_height - height) / 2; 352 y += (aa->height - height) / 2;
353 } 353 }
354 354
355 if (!clear) 355 if (!clear)