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