mirror of
https://github.com/libretro/RetroArch
synced 2025-02-19 21:40:49 +00:00
We can take out RPNG implementation details out of video_texture_image.c
now
This commit is contained in:
parent
e7e9e90b0d
commit
52948b436e
@ -26,9 +26,6 @@
|
|||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
#include <formats/image.h>
|
#include <formats/image.h>
|
||||||
#include <file/nbio.h>
|
#include <file/nbio.h>
|
||||||
#ifdef HAVE_RPNG
|
|
||||||
#include <formats/rpng.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_RJPEG
|
#ifdef HAVE_RJPEG
|
||||||
#include <formats/rjpeg.h>
|
#include <formats/rjpeg.h>
|
||||||
#endif
|
#endif
|
||||||
@ -93,8 +90,6 @@ bool video_texture_image_color_convert(unsigned r_shift,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_RPNG
|
|
||||||
|
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
|
|
||||||
#define GX_BLIT_LINE_32(off) \
|
#define GX_BLIT_LINE_32(off) \
|
||||||
@ -158,7 +153,7 @@ static bool video_texture_image_internal_gx_convert_texture32(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool video_texture_image_load_png(
|
static bool video_texture_image_load_internal(
|
||||||
enum image_type_enum type,
|
enum image_type_enum type,
|
||||||
void *ptr,
|
void *ptr,
|
||||||
struct texture_image *out_img,
|
struct texture_image *out_img,
|
||||||
@ -167,24 +162,24 @@ static bool video_texture_image_load_png(
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
rpng_t *rpng = (rpng_t*)image_transfer_new(type);
|
void *img = image_transfer_new(type);
|
||||||
|
|
||||||
if (!rpng)
|
if (!img)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
image_transfer_set_buffer_ptr(rpng, type, (uint8_t*)ptr);
|
image_transfer_set_buffer_ptr(img, type, (uint8_t*)ptr);
|
||||||
|
|
||||||
if (!image_transfer_start(rpng, type))
|
if (!image_transfer_start(img, type))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
while (image_transfer_iterate((void*)rpng, type));
|
while (image_transfer_iterate(img, type));
|
||||||
|
|
||||||
if (!rpng_is_valid(rpng))
|
if (!image_transfer_is_valid(img, type))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = image_transfer_process((void*)rpng, type,
|
ret = image_transfer_process(img, type,
|
||||||
(uint32_t**)&out_img->pixels, 0, &out_img->width,
|
(uint32_t**)&out_img->pixels, 0, &out_img->width,
|
||||||
&out_img->height);
|
&out_img->height);
|
||||||
}while(ret == IMAGE_PROCESS_NEXT);
|
}while(ret == IMAGE_PROCESS_NEXT);
|
||||||
@ -206,12 +201,11 @@ static bool video_texture_image_load_png(
|
|||||||
success = true;
|
success = true;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (rpng)
|
if (img)
|
||||||
image_transfer_free(rpng, type);
|
image_transfer_free(img, type);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void video_texture_image_free(struct texture_image *img)
|
void video_texture_image_free(struct texture_image *img)
|
||||||
@ -276,13 +270,11 @@ bool video_texture_image_load(struct texture_image *out_img,
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case IMAGE_FORMAT_PNG:
|
case IMAGE_FORMAT_PNG:
|
||||||
#ifdef HAVE_RPNG
|
if (video_texture_image_load_internal(
|
||||||
if (video_texture_image_load_png(
|
|
||||||
IMAGE_TYPE_PNG,
|
IMAGE_TYPE_PNG,
|
||||||
ptr,out_img,
|
ptr,out_img,
|
||||||
a_shift, r_shift, g_shift, b_shift))
|
a_shift, r_shift, g_shift, b_shift))
|
||||||
goto success;
|
goto success;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case IMAGE_FORMAT_JPEG:
|
case IMAGE_FORMAT_JPEG:
|
||||||
#ifdef HAVE_RJPEG
|
#ifdef HAVE_RJPEG
|
||||||
|
@ -71,6 +71,29 @@ bool image_transfer_start(void *data, enum image_type_enum type)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool image_transfer_is_valid(
|
||||||
|
void *data,
|
||||||
|
enum image_type_enum type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case IMAGE_TYPE_PNG:
|
||||||
|
#ifdef HAVE_RPNG
|
||||||
|
return rpng_is_valid((rpng_t*)data);
|
||||||
|
#else
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case IMAGE_TYPE_JPEG:
|
||||||
|
#ifdef HAVE_RJPEG
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void image_transfer_set_buffer_ptr(
|
void image_transfer_set_buffer_ptr(
|
||||||
void *data,
|
void *data,
|
||||||
enum image_type_enum type,
|
enum image_type_enum type,
|
||||||
|
@ -77,6 +77,8 @@ int image_transfer_process(
|
|||||||
|
|
||||||
bool image_transfer_iterate(void *data, enum image_type_enum type);
|
bool image_transfer_iterate(void *data, enum image_type_enum type);
|
||||||
|
|
||||||
|
bool image_transfer_is_valid(void *data, enum image_type_enum type);
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user