mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-09 20:41:19 +00:00
Create texture_image_set_color_shifts
This commit is contained in:
parent
498caabfc7
commit
ef98d02185
@ -48,6 +48,20 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool texture_image_set_color_shifts(unsigned *r_shift, unsigned *g_shift,
|
||||||
|
unsigned *b_shift, unsigned *a_shift)
|
||||||
|
{
|
||||||
|
driver_t *driver = driver_get_ptr();
|
||||||
|
/* This interface "leak" is very ugly. FIXME: Fix this properly ... */
|
||||||
|
bool use_rgba = driver ? driver->gfx_use_rgba : false;
|
||||||
|
*a_shift = 24;
|
||||||
|
*r_shift = use_rgba ? 0 : 16;
|
||||||
|
*g_shift = 8;
|
||||||
|
*b_shift = use_rgba ? 16 : 0;
|
||||||
|
|
||||||
|
return use_rgba;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_RPNG
|
#ifdef HAVE_RPNG
|
||||||
static bool rpng_image_load_argb_shift(const char *path,
|
static bool rpng_image_load_argb_shift(const char *path,
|
||||||
struct texture_image *out_img,
|
struct texture_image *out_img,
|
||||||
@ -355,6 +369,7 @@ error:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool texture_image_load(struct texture_image *out_img, const char *path)
|
bool texture_image_load(struct texture_image *out_img, const char *path)
|
||||||
{
|
{
|
||||||
if (!out_img)
|
if (!out_img)
|
||||||
@ -368,22 +383,21 @@ bool texture_image_load(struct texture_image *out_img, const char *path)
|
|||||||
#else
|
#else
|
||||||
bool texture_image_load(struct texture_image *out_img, const char *path)
|
bool texture_image_load(struct texture_image *out_img, const char *path)
|
||||||
{
|
{
|
||||||
|
bool ret = false;
|
||||||
|
unsigned r_shift, g_shift, b_shift, a_shift;
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
|
|
||||||
/* This interface "leak" is very ugly. FIXME: Fix this properly ... */
|
texture_image_set_color_shifts(&r_shift, &g_shift, &b_shift,
|
||||||
bool ret = false;
|
&a_shift);
|
||||||
bool use_rgba = driver->gfx_use_rgba;
|
|
||||||
unsigned a_shift = 24;
|
(void)ret;
|
||||||
unsigned r_shift = use_rgba ? 0 : 16;
|
|
||||||
unsigned g_shift = 8;
|
|
||||||
unsigned b_shift = use_rgba ? 16 : 0;
|
|
||||||
|
|
||||||
if (strstr(path, ".tga"))
|
if (strstr(path, ".tga"))
|
||||||
{
|
{
|
||||||
void *raw_buf = NULL;
|
void *raw_buf = NULL;
|
||||||
uint8_t *buf = NULL;
|
uint8_t *buf = NULL;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
bool ret = read_file(path, &raw_buf, &len);
|
ret = read_file(path, &raw_buf, &len);
|
||||||
|
|
||||||
if (!ret || len < 0)
|
if (!ret || len < 0)
|
||||||
{
|
{
|
||||||
@ -419,7 +433,6 @@ bool texture_image_load(struct texture_image *out_img, const char *path)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user