(image_rpng.c) Minor cleanups
This commit is contained in:
parent
b04b1d2506
commit
8adb16bf0a
|
@ -116,8 +116,9 @@ static bool rpng_image_load_argb_shift(const char *path,
|
||||||
if (strstr(path, ".tga"))
|
if (strstr(path, ".tga"))
|
||||||
return rpng_image_load_tga_shift(path, out_img,
|
return rpng_image_load_tga_shift(path, out_img,
|
||||||
a_shift, r_shift, g_shift, b_shift);
|
a_shift, r_shift, g_shift, b_shift);
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
else if (strstr(path, ".png"))
|
if (strstr(path, ".png"))
|
||||||
{
|
{
|
||||||
bool ret = rpng_load_image_argb(path,
|
bool ret = rpng_load_image_argb(path,
|
||||||
&out_img->pixels, &out_img->width, &out_img->height);
|
&out_img->pixels, &out_img->width, &out_img->height);
|
||||||
|
@ -125,7 +126,7 @@ static bool rpng_image_load_argb_shift(const char *path,
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// This is quite uncommon ...
|
/* This is quite uncommon. */
|
||||||
if (a_shift != 24 || r_shift != 16 || g_shift != 8 || b_shift != 0)
|
if (a_shift != 24 || r_shift != 16 || g_shift != 8 || b_shift != 0)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
@ -224,13 +225,10 @@ void texture_image_free(struct texture_image *img)
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/* This interface "leak" is very ugly. FIXME: Fix this properly ... */
|
/* This interface "leak" is very ugly. FIXME: Fix this properly ... */
|
||||||
if (driver.gfx_use_rgba)
|
bool use_rgba = driver.gfx_use_rgba;
|
||||||
ret = rpng_image_load_argb_shift(path, out_img, 24, 0, 8, 16);
|
bool ret = rpng_image_load_argb_shift(path, out_img, 24,
|
||||||
else
|
use_rgba ? 0 : 16, 8, use_rgba ? 16 : 0);
|
||||||
ret = rpng_image_load_argb_shift(path, out_img, 24, 16, 8, 0);
|
|
||||||
|
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -238,7 +236,7 @@ bool texture_image_load(struct texture_image *out_img, const char *path)
|
||||||
if (!rpng_gx_convert_texture32(out_img))
|
if (!rpng_gx_convert_texture32(out_img))
|
||||||
{
|
{
|
||||||
texture_image_free(out_img);
|
texture_image_free(out_img);
|
||||||
ret = false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue