mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 09:32:52 +00:00
Some more cleanups
This commit is contained in:
parent
33c818cf81
commit
d07cb93057
@ -8,7 +8,7 @@ CFLAGS += -DHAVE_IMLIB2
|
||||
LDFLAGS += -lImlib2
|
||||
endif
|
||||
|
||||
SOURCES := rpng.c rpng_test.c ../../file/nbio/nbio_stdio.c
|
||||
SOURCES := rpng_nbio.c rpng_test.c ../../file/nbio/nbio_stdio.c
|
||||
OBJS := $(SOURCES:.c=.o)
|
||||
|
||||
CFLAGS += -Wall -pedantic -std=gnu99 -O0 -g -DHAVE_ZLIB -DHAVE_ZLIB_DEFLATE -DRPNG_TEST -I../../include
|
||||
|
@ -693,19 +693,27 @@ bool rpng_load_image_argb_iterate(FILE *file, struct png_chunk *chunk,
|
||||
break;
|
||||
|
||||
case PNG_CHUNK_IDAT:
|
||||
if (!(*has_ihdr) || *has_iend || (ihdr->color_type == 3 && !(*has_plte)))
|
||||
return false;
|
||||
{
|
||||
if (!(*has_ihdr) || *has_iend || (ihdr->color_type == 3 && !(*has_plte)))
|
||||
return false;
|
||||
|
||||
if (!png_realloc_idat(chunk, idat_buf))
|
||||
return false;
|
||||
if (!png_realloc_idat(chunk, idat_buf))
|
||||
return false;
|
||||
|
||||
if (fread(idat_buf->data + idat_buf->size, 1, chunk->size, file) != chunk->size)
|
||||
return false;
|
||||
if (fread(idat_buf->data + idat_buf->size, 1, chunk->size, file) != chunk->size)
|
||||
return false;
|
||||
|
||||
*increment_size = sizeof(uint32_t);
|
||||
idat_buf->size += chunk->size;
|
||||
*increment_size = sizeof(uint32_t);
|
||||
idat_buf->size += chunk->size;
|
||||
|
||||
*has_idat = true;
|
||||
for (i = 0; i < idat_buf->size; i++)
|
||||
{
|
||||
fprintf(stderr, "%c", idat_buf->data[i]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
*has_idat = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case PNG_CHUNK_IEND:
|
||||
|
@ -618,10 +618,12 @@ bool rpng_load_image_argb_iterate(uint8_t *buf,
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
#if 0
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
fprintf(stderr, "chunktype: %c\n", chunk->type[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (png_chunk_type(chunk))
|
||||
{
|
||||
@ -675,9 +677,13 @@ bool rpng_load_image_argb_iterate(uint8_t *buf,
|
||||
if (!png_realloc_idat(chunk, idat_buf))
|
||||
return false;
|
||||
|
||||
buf += 8;
|
||||
|
||||
for (i = 0; i < chunk->size; i++)
|
||||
idat_buf->data[i + idat_buf->size] = buf[i];
|
||||
|
||||
idat_buf->size += chunk->size;
|
||||
|
||||
*has_idat = true;
|
||||
break;
|
||||
|
||||
@ -810,9 +816,11 @@ bool rpng_load_image_argb(const char *path, uint32_t **data,
|
||||
buff_data += 4 + 4 + chunk.size + 4;
|
||||
}
|
||||
|
||||
#if 0
|
||||
fprintf(stderr, "has_ihdr: %d\n", has_ihdr);
|
||||
fprintf(stderr, "has_idat: %d\n", has_idat);
|
||||
fprintf(stderr, "has_iend: %d\n", has_iend);
|
||||
#endif
|
||||
|
||||
if (!has_ihdr || !has_idat || !has_iend)
|
||||
GOTO_END_ERROR();
|
||||
|
Loading…
x
Reference in New Issue
Block a user