Merge pull request #1177 from lakkatv/xmb

(Lakka) Generate mipmaps, and use only 256x256 png
This commit is contained in:
Twinaphex 2014-10-22 01:32:37 +02:00
commit c94a8e24d7

View File

@ -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;