Move gfx_display_reset_textures_list_buffer to gfx_display.c

This commit is contained in:
libretroadmin 2022-07-06 13:11:44 +02:00
parent 3aafa40c69
commit 3c20e709ea
3 changed files with 45 additions and 33 deletions

View File

@ -1181,6 +1181,35 @@ void gfx_display_draw_keyboard(
}
}
/* NOTE: Reads image from memory buffer */
bool gfx_display_reset_textures_list_buffer(
uintptr_t *item, enum texture_filter_type filter_type,
void* buffer, unsigned buffer_len, enum image_type_enum image_type,
unsigned *width, unsigned *height)
{
struct texture_image ti;
ti.width = 0;
ti.height = 0;
ti.pixels = NULL;
ti.supports_rgba = video_driver_supports_rgba();
if (!image_texture_load_buffer(&ti, image_type, buffer, buffer_len))
return false;
if (width)
*width = ti.width;
if (height)
*height = ti.height;
/* if the poke interface doesn't support texture load then return false */
if (!video_driver_texture_load(&ti, filter_type, item))
return false;
image_texture_free(&ti);
return true;
}
/* NOTE: Reads image from file */
bool gfx_display_reset_textures_list(
const char *texture_path, const char *iconpath,

View File

@ -296,9 +296,21 @@ font_data_t *gfx_display_font_file(gfx_display_t *p_disp,
char* fontpath, float font_size, bool is_threaded);
bool gfx_display_reset_textures_list(
const char *texture_path, const char *iconpath,
uintptr_t *item, enum texture_filter_type filter_type,
unsigned *width, unsigned *height);
const char *texture_path,
const char *iconpath,
uintptr_t *item,
enum texture_filter_type filter_type,
unsigned *width,
unsigned *height);
bool gfx_display_reset_textures_list_buffer(
uintptr_t *item,
enum texture_filter_type filter_type,
void* buffer,
unsigned buffer_len,
enum image_type_enum image_type,
unsigned *width,
unsigned *height);
/* Returns the OSK key at a given position */
int gfx_display_osk_ptr_at_pos(void *data, int x, int y,

View File

@ -2122,35 +2122,6 @@ void gfx_widgets_deinit(bool widgets_persisting)
}
#ifdef HAVE_TRANSLATE
/* NOTE: Reads image from memory buffer */
static bool gfx_widgets_reset_textures_list_buffer(
uintptr_t *item, enum texture_filter_type filter_type,
void* buffer, unsigned buffer_len, enum image_type_enum image_type,
unsigned *width, unsigned *height)
{
struct texture_image ti;
ti.width = 0;
ti.height = 0;
ti.pixels = NULL;
ti.supports_rgba = video_driver_supports_rgba();
if (!image_texture_load_buffer(&ti, image_type, buffer, buffer_len))
return false;
if (width)
*width = ti.width;
if (height)
*height = ti.height;
/* if the poke interface doesn't support texture load then return false */
if (!video_driver_texture_load(&ti, filter_type, item))
return false;
image_texture_free(&ti);
return true;
}
bool gfx_widgets_ai_service_overlay_load(
char* buffer, unsigned buffer_len,
enum image_type_enum image_type)
@ -2158,7 +2129,7 @@ bool gfx_widgets_ai_service_overlay_load(
dispgfx_widget_t *p_dispwidget = &dispwidget_st;
if (p_dispwidget->ai_service_overlay_state == 0)
{
if (!gfx_widgets_reset_textures_list_buffer(
if (!gfx_display_reset_textures_list_buffer(
&p_dispwidget->ai_service_overlay_texture,
TEXTURE_FILTER_MIPMAP_LINEAR,
(void *) buffer, buffer_len, image_type,