From 1ef482d6dfa88d06c585d6f1bd7a521fabf37747 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Tue, 7 Feb 2017 21:48:18 -0500 Subject: [PATCH] Apply icon scaling to the battery and clock icons --- menu/drivers/xmb.c | 52 +++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 25bdee0e3f..9ca3ea7ace 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -549,7 +549,8 @@ static void xmb_draw_icon( float rotation, float scale_factor, float *color, - float shadow_offset) + float shadow_offset, + float icon_scale) { menu_display_ctx_draw_t draw; struct video_coords coords; @@ -575,6 +576,9 @@ static void xmb_draw_icon( draw.width *= scale_factor; draw.height *= scale_factor; #endif + // Allow the icon to be scaled outside of the scale factor. + draw.width *= icon_scale; + draw.height *= icon_scale; draw.coords = &coords; draw.matrix_data = mymat; draw.texture = texture; @@ -2329,7 +2333,8 @@ static void xmb_draw_items( rotation, scale_factor, &color[0], - xmb->shadow_offset); + xmb->shadow_offset, + 1.0); } menu_display_set_alpha(color, MIN(node->alpha, xmb->alpha)); @@ -2349,7 +2354,8 @@ static void xmb_draw_items( 0, 1, &color[0], - xmb->shadow_offset); + xmb->shadow_offset, + 1.0); } menu_display_blend_end(); @@ -2674,9 +2680,6 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) if (percent > 0) { - size_t x_pos = xmb->icon.size / 6; - size_t x_pos_icon = xmb->margins.title.left; - if (coord_white[3] != 0) xmb_draw_icon( menu_disp_info, @@ -2684,22 +2687,23 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) &mymat, xmb->textures.list[charging ? XMB_TEXTURE_BATTERY_CHARGING : XMB_TEXTURE_BATTERY_FULL], - width - (xmb->icon.size / 2) - x_pos_icon, - xmb->icon.size, + width - xmb->margins.title.left - (xmb->icon.size / 2), + xmb->icon.size - (xmb->icon.size / 3), width, height, 1, 0, 1, &coord_white[0], - xmb->shadow_offset); + xmb->shadow_offset, + 0.5); snprintf(msg, sizeof(msg), "%d%%", percent); percent_width = font_driver_get_message_width(xmb->font, msg, utf8len(msg), 1); xmb_draw_text(menu_disp_info, xmb, msg, - width - xmb->margins.title.left - x_pos, + width - xmb->margins.title.left - (xmb->icon.size / 2), xmb->margins.title.top, 1, 1, TEXT_ALIGN_RIGHT, width, height, xmb->font); } @@ -2711,26 +2715,27 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) char timedate[255]; int x_pos = 0; + // Move the timedate widget over if the battery percent is active. + if (percent_width) + x_pos = percent_width + xmb->icon.size; + if (coord_white[3] != 0) { - int x_pos = 0; - - if (percent_width) - x_pos = percent_width + (xmb->icon.size / 2.5); - xmb_draw_icon( menu_disp_info, xmb->icon.size, &mymat, xmb->textures.list[XMB_TEXTURE_CLOCK], - width - xmb->icon.size - x_pos, - xmb->icon.size,width, + width - xmb->margins.title.left - (xmb->icon.size / 2.5) - x_pos, + xmb->icon.size - (xmb->icon.size / 3), + width, height, 1, 0, 1, &coord_white[0], - xmb->shadow_offset); + xmb->shadow_offset, + 0.5); } timedate[0] = '\0'; @@ -2741,11 +2746,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) menu_display_timedate(&datetime); - if (percent_width) - x_pos = percent_width + (xmb->icon.size / 2.5); - xmb_draw_text(menu_disp_info, xmb, timedate, - width - xmb->margins.title.left - xmb->icon.size / 4 - x_pos, + width - xmb->margins.title.left - (xmb->icon.size / 2) - x_pos, xmb->margins.title.top, 1, 1, TEXT_ALIGN_RIGHT, width, height, xmb->font); } @@ -2770,7 +2772,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) 0, 1, &coord_white[0], - xmb->shadow_offset); + xmb->shadow_offset, + 1.0); menu_display_blend_begin(); @@ -2819,7 +2822,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) rotation, scale_factor, &item_color[0], - xmb->shadow_offset); + xmb->shadow_offset, + 1.0); } }