From e3594f36ddac919ceeb0ef6e69cdf806a84ba497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 22 Oct 2014 01:22:22 +0200 Subject: [PATCH] (XMB) Generate mipmaps, and use only 256x256 png --- frontend/menu/disp/xmb.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/frontend/menu/disp/xmb.c b/frontend/menu/disp/xmb.c index ec3fe4bec9..c1001b833d 100644 --- a/frontend/menu/disp/xmb.c +++ b/frontend/menu/disp/xmb.c @@ -755,33 +755,15 @@ static void *xmb_init(void) xmb->active_item_factor = 3.0; xmb->under_item_offset = 5.0; - float scale_factor; + float scale_factor = 1; + if (gl->win_width >= 3840) scale_factor = 2.0; + else if (gl->win_width >= 2560) scale_factor = 1.5; + else if (gl->win_width >= 1920) scale_factor = 1.0; + else if (gl->win_width >= 1280) scale_factor = 0.75; + else if (gl->win_width >= 640) scale_factor = 0.5; + else if (gl->win_width >= 320) scale_factor = 0.25; - if (gl->win_width >= 3840) - { - scale_factor = 2.0; - strlcpy(xmb->icon_dir, "256", sizeof(xmb->icon_dir)); - } - else if (gl->win_width >= 2560) - { - scale_factor = 1.5; - strlcpy(xmb->icon_dir, "192", sizeof(xmb->icon_dir)); - } - else if (gl->win_width >= 1920) - { - scale_factor = 1.0; - strlcpy(xmb->icon_dir, "128", sizeof(xmb->icon_dir)); - } - else if (gl->win_width <= 640) - { - scale_factor = 0.5; - strlcpy(xmb->icon_dir, "64", sizeof(xmb->icon_dir)); - } - else - { - scale_factor = 3.0f/4.0f; - strlcpy(xmb->icon_dir, "96", sizeof(xmb->icon_dir)); - } + strlcpy(xmb->icon_dir, "256", sizeof(xmb->icon_dir)); xmb->icon_size = 128.0 * scale_factor; xmb->hspacing = 200.0 * scale_factor; @@ -828,8 +810,9 @@ static GLuint xmb_png_texture_load_(const char * file_name) glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ti.width, ti.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, ti.pixels); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glGenerateMipmap(GL_TEXTURE_2D); free(ti.pixels);