ozone: fix thumbnails position and size
This commit is contained in:
parent
d65068cf15
commit
f50567d340
|
@ -2333,7 +2333,7 @@ static bool ozone_load_image(void *userdata, void *data, enum menu_image_type ty
|
||||||
ozone_handle_t *ozone = (ozone_handle_t*) userdata;
|
ozone_handle_t *ozone = (ozone_handle_t*) userdata;
|
||||||
unsigned sidebar_height;
|
unsigned sidebar_height;
|
||||||
unsigned height;
|
unsigned height;
|
||||||
unsigned maximum_height;
|
unsigned maximum_height, maximum_width;
|
||||||
|
|
||||||
if (!ozone || !data)
|
if (!ozone || !data)
|
||||||
return false;
|
return false;
|
||||||
|
@ -2342,18 +2342,27 @@ static bool ozone_load_image(void *userdata, void *data, enum menu_image_type ty
|
||||||
|
|
||||||
sidebar_height = height - ozone->dimensions.header_height - 55 - ozone->dimensions.footer_height;
|
sidebar_height = height - ozone->dimensions.header_height - 55 - ozone->dimensions.footer_height;
|
||||||
maximum_height = sidebar_height / 2;
|
maximum_height = sidebar_height / 2;
|
||||||
|
maximum_width = ozone->dimensions.thumbnail_bar_width - ozone->dimensions.sidebar_entry_icon_padding * 2;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case MENU_IMAGE_THUMBNAIL:
|
case MENU_IMAGE_THUMBNAIL:
|
||||||
{
|
{
|
||||||
struct texture_image *img = (struct texture_image*)data;
|
struct texture_image *img = (struct texture_image*)data;
|
||||||
|
float scale_down;
|
||||||
|
|
||||||
ozone->dimensions.thumbnail_height = ozone->dimensions.thumbnail_width
|
ozone->dimensions.thumbnail_height = ozone->dimensions.thumbnail_width
|
||||||
* (float)img->height / (float)img->width;
|
* (float)img->height / (float)img->width;
|
||||||
|
|
||||||
if (ozone->dimensions.thumbnail_height > maximum_height)
|
scale_down = (float) maximum_height / ozone->dimensions.thumbnail_height;
|
||||||
|
|
||||||
|
ozone->dimensions.thumbnail_height *= scale_down;
|
||||||
|
ozone->dimensions.thumbnail_width *= scale_down;
|
||||||
|
|
||||||
|
if (ozone->dimensions.thumbnail_width > (float)maximum_width)
|
||||||
{
|
{
|
||||||
float scale_down = (float) maximum_height / (float) ozone->dimensions.thumbnail_height;
|
scale_down = (float) maximum_width / ozone->dimensions.thumbnail_width;
|
||||||
|
|
||||||
ozone->dimensions.thumbnail_height *= scale_down;
|
ozone->dimensions.thumbnail_height *= scale_down;
|
||||||
ozone->dimensions.thumbnail_width *= scale_down;
|
ozone->dimensions.thumbnail_width *= scale_down;
|
||||||
}
|
}
|
||||||
|
|
|
@ -700,7 +700,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
|
||||||
/* Top row : thumbnail or no thumbnail available message */
|
/* Top row : thumbnail or no thumbnail available message */
|
||||||
if (thumbnail)
|
if (thumbnail)
|
||||||
{
|
{
|
||||||
unsigned thumb_x_position = x_position + sidebar_width/2 - (ozone->dimensions.thumbnail_width + ozone->dimensions.sidebar_entry_icon_padding) / 2;
|
unsigned thumb_x_position = x_position + sidebar_width/2 - ozone->dimensions.thumbnail_width / 2;
|
||||||
unsigned thumb_y_position = video_info->height / 2 - ozone->dimensions.thumbnail_height / 2;
|
unsigned thumb_y_position = video_info->height / 2 - ozone->dimensions.thumbnail_height / 2;
|
||||||
|
|
||||||
if (!string_is_equal(ozone->selection_core_name, "imageviewer"))
|
if (!string_is_equal(ozone->selection_core_name, "imageviewer"))
|
||||||
|
@ -731,7 +731,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
|
||||||
/* Bottom row : "left" thumbnail or content metadata */
|
/* Bottom row : "left" thumbnail or content metadata */
|
||||||
if (thumbnail && left_thumbnail)
|
if (thumbnail && left_thumbnail)
|
||||||
{
|
{
|
||||||
unsigned thumb_x_position = x_position + sidebar_width/2 - (ozone->dimensions.left_thumbnail_width + ozone->dimensions.sidebar_entry_icon_padding) / 2;
|
unsigned thumb_x_position = x_position + sidebar_width/2 - ozone->dimensions.left_thumbnail_width / 2;
|
||||||
unsigned thumb_y_position = video_info->height / 2 + ozone->dimensions.sidebar_entry_icon_padding / 2;
|
unsigned thumb_y_position = video_info->height / 2 + ozone->dimensions.sidebar_entry_icon_padding / 2;
|
||||||
|
|
||||||
ozone_draw_icon(video_info,
|
ozone_draw_icon(video_info,
|
||||||
|
|
Loading…
Reference in New Issue