Create menu_display_reset_textures_list

This commit is contained in:
twinaphex 2016-07-21 03:00:00 +02:00
parent 5545020695
commit 6e5738f8b0
4 changed files with 25 additions and 36 deletions

View File

@ -151,22 +151,7 @@ static void mui_context_reset_textures(mui_handle_t *mui)
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_ICONS); APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_ICONS);
for (i = 0; i < MUI_TEXTURE_LAST; i++) for (i = 0; i < MUI_TEXTURE_LAST; i++)
{ menu_display_reset_textures_list(mui_texture_path(i), iconpath, &mui->textures.list[i]);
struct texture_image ti = {0};
char path[PATH_MAX_LENGTH] = {0};
const char *texture_path = mui_texture_path(i);
if (texture_path != NULL)
fill_pathname_join(path, iconpath, texture_path, sizeof(path));
if (string_is_empty(path) || !path_file_exists(path))
continue;
image_texture_load(&ti, path);
video_driver_texture_load(&ti,
TEXTURE_FILTER_MIPMAP_LINEAR, &mui->textures.list[i]);
image_texture_free(&ti);
}
} }
static void mui_draw_icon( static void mui_draw_icon(

View File

@ -2716,26 +2716,7 @@ static void xmb_context_reset_textures(
unsigned i; unsigned i;
for (i = 0; i < XMB_TEXTURE_LAST; i++) for (i = 0; i < XMB_TEXTURE_LAST; i++)
{ menu_display_reset_textures_list(xmb_texture_path(i), iconpath, &xmb->textures.list[i]);
struct texture_image ti = {0};
char path[PATH_MAX_LENGTH] = {0};
const char *texture_path = xmb_texture_path(i);
if (texture_path != NULL)
fill_pathname_join(path, iconpath, texture_path, sizeof(path));
if (string_is_empty(path) || !path_file_exists(path))
continue;
image_texture_load(&ti, path);
video_driver_texture_unload(&xmb->textures.list[i]);
video_driver_texture_load(&ti,
TEXTURE_FILTER_MIPMAP_LINEAR,
&xmb->textures.list[i]);
image_texture_free(&ti);
}
menu_display_allocate_white_texture(); menu_display_allocate_white_texture();

View File

@ -19,6 +19,7 @@
#include <queues/message_queue.h> #include <queues/message_queue.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <formats/image.h> #include <formats/image.h>
#include <file/file_path.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#include "../config.def.h" #include "../config.def.h"
@ -26,6 +27,7 @@
#include "../configuration.h" #include "../configuration.h"
#include "../runloop.h" #include "../runloop.h"
#include "../core.h" #include "../core.h"
#include "../gfx/video_driver.h"
#include "../gfx/video_thread_wrapper.h" #include "../gfx/video_thread_wrapper.h"
#include "../verbosity.h" #include "../verbosity.h"
@ -805,3 +807,21 @@ void menu_display_set_alpha(float *color, float alpha_value)
return; return;
color[3] = color[7] = color[11] = color[15] = alpha_value; color[3] = color[7] = color[11] = color[15] = alpha_value;
} }
void menu_display_reset_textures_list(const char *texture_path, const char *iconpath,
uintptr_t *item)
{
struct texture_image ti = {0};
char path[PATH_MAX_LENGTH] = {0};
if (texture_path != NULL)
fill_pathname_join(path, iconpath, texture_path, sizeof(path));
if (string_is_empty(path) || !path_file_exists(path))
return;
image_texture_load(&ti, path);
video_driver_texture_load(&ti,
TEXTURE_FILTER_MIPMAP_LINEAR, item);
image_texture_free(&ti);
}

View File

@ -251,6 +251,9 @@ void menu_display_set_alpha(float *color, float alpha_value);
bool menu_display_font(enum application_special_type type); bool menu_display_font(enum application_special_type type);
void menu_display_reset_textures_list(const char *texture_path, const char *iconpath,
uintptr_t *item);
extern uintptr_t menu_display_white_texture; extern uintptr_t menu_display_white_texture;
extern menu_display_ctx_driver_t menu_display_ctx_gl; extern menu_display_ctx_driver_t menu_display_ctx_gl;