(gfx/video_texture_image.c) Refactors

This commit is contained in:
twinaphex 2016-01-30 02:48:43 +01:00
parent a267bdfbe3
commit 8cf1acb7c6
1 changed files with 31 additions and 23 deletions

View File

@ -178,14 +178,11 @@ void video_texture_image_free(struct texture_image *img)
memset(img, 0, sizeof(*img));
}
bool video_texture_image_load(struct texture_image *out_img, const char *path)
{
unsigned r_shift, g_shift, b_shift, a_shift;
video_texture_image_set_color_shifts(&r_shift, &g_shift, &b_shift,
&a_shift);
if (strstr(path, ".tga"))
static bool video_texture_image_load_tga(
const char *path,
struct texture_image *out_img,
unsigned a_shift, unsigned r_shift,
unsigned g_shift, unsigned b_shift)
{
ssize_t len;
void *raw_buf = NULL;
@ -208,12 +205,23 @@ bool video_texture_image_load(struct texture_image *out_img, const char *path)
return ret;
}
#ifdef HAVE_RPNG
else if (strstr(path, ".png"))
bool video_texture_image_load(struct texture_image *out_img, const char *path)
{
unsigned r_shift, g_shift, b_shift, a_shift;
video_texture_image_set_color_shifts(&r_shift, &g_shift, &b_shift,
&a_shift);
if (strstr(path, ".tga"))
return video_texture_image_load_tga(path, out_img,
a_shift, r_shift, g_shift, b_shift);
#ifdef HAVE_RPNG
if (strstr(path, ".png"))
return video_texture_image_load_png(path, out_img,
a_shift, r_shift, g_shift, b_shift);
}
#endif
return false;