mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Move reset_list_buffer to gfx_widgets and turn it into a static function
This commit is contained in:
parent
783bcb7a61
commit
9d6bfabd02
@ -1648,6 +1648,7 @@ void gfx_display_draw_text(
|
|||||||
video_driver_set_osd_msg(text, ¶ms, (void*)font);
|
video_driver_set_osd_msg(text, ¶ms, (void*)font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* NOTE: Reads image from file */
|
||||||
bool gfx_display_reset_textures_list(
|
bool gfx_display_reset_textures_list(
|
||||||
const char *texture_path, const char *iconpath,
|
const char *texture_path, const char *iconpath,
|
||||||
uintptr_t *item, enum texture_filter_type filter_type,
|
uintptr_t *item, enum texture_filter_type filter_type,
|
||||||
@ -1687,35 +1688,6 @@ bool gfx_display_reset_textures_list(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Teardown; deinitializes and frees all
|
/* Teardown; deinitializes and frees all
|
||||||
* fonts associated to the display driver */
|
* fonts associated to the display driver */
|
||||||
void gfx_display_font_free(font_data_t *font)
|
void gfx_display_font_free(font_data_t *font)
|
||||||
|
@ -324,12 +324,6 @@ bool gfx_display_reset_textures_list(
|
|||||||
uintptr_t *item, enum texture_filter_type filter_type,
|
uintptr_t *item, enum texture_filter_type filter_type,
|
||||||
unsigned *width, unsigned *height);
|
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 */
|
/* Returns the OSK key at a given position */
|
||||||
int gfx_display_osk_ptr_at_pos(void *data, int x, int y,
|
int gfx_display_osk_ptr_at_pos(void *data, int x, int y,
|
||||||
unsigned width, unsigned height);
|
unsigned width, unsigned height);
|
||||||
|
@ -2047,6 +2047,35 @@ static void gfx_widgets_free(dispgfx_widget_t *p_dispwidget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_TRANSLATE
|
#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(
|
bool gfx_widgets_ai_service_overlay_load(
|
||||||
dispgfx_widget_t *p_dispwidget,
|
dispgfx_widget_t *p_dispwidget,
|
||||||
char* buffer, unsigned buffer_len,
|
char* buffer, unsigned buffer_len,
|
||||||
@ -2054,7 +2083,7 @@ bool gfx_widgets_ai_service_overlay_load(
|
|||||||
{
|
{
|
||||||
if (p_dispwidget->ai_service_overlay_state == 0)
|
if (p_dispwidget->ai_service_overlay_state == 0)
|
||||||
{
|
{
|
||||||
bool res = gfx_display_reset_textures_list_buffer(
|
bool res = gfx_widgets_reset_textures_list_buffer(
|
||||||
&p_dispwidget->ai_service_overlay_texture,
|
&p_dispwidget->ai_service_overlay_texture,
|
||||||
TEXTURE_FILTER_MIPMAP_LINEAR,
|
TEXTURE_FILTER_MIPMAP_LINEAR,
|
||||||
(void *) buffer, buffer_len, image_type,
|
(void *) buffer, buffer_len, image_type,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user