From 1e727c0c31af628b3c0ef8de605cfda553f03a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 22 Oct 2014 01:28:16 +0200 Subject: [PATCH] (Lakka) Generate mipmaps, and use only 256x256 png --- frontend/menu/disp/lakka.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/frontend/menu/disp/lakka.c b/frontend/menu/disp/lakka.c index 213f0d5317..b834844c82 100644 --- a/frontend/menu/disp/lakka.c +++ b/frontend/menu/disp/lakka.c @@ -599,8 +599,9 @@ static GLuint lakka_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); @@ -1159,33 +1160,15 @@ static void *lakka_init(void) lakka->active_item_factor = 3.0; lakka->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(lakka->icon_dir, "256", sizeof(lakka->icon_dir)); - } - else if (gl->win_width >= 2560) - { - scale_factor = 1.5; - strlcpy(lakka->icon_dir, "192", sizeof(lakka->icon_dir)); - } - else if (gl->win_width >= 1920) - { - scale_factor = 1.0; - strlcpy(lakka->icon_dir, "128", sizeof(lakka->icon_dir)); - } - else if (gl->win_width <= 640) - { - scale_factor = 0.5; - strlcpy(lakka->icon_dir, "64", sizeof(lakka->icon_dir)); - } - else - { - scale_factor = 3.0f/4.0f; - strlcpy(lakka->icon_dir, "96", sizeof(lakka->icon_dir)); - } + strlcpy(lakka->icon_dir, "256", sizeof(lakka->icon_dir)); lakka->icon_size = 128.0 * scale_factor; lakka->hspacing = 200.0 * scale_factor;