mirror of
https://github.com/libretro/RetroArch
synced 2025-04-02 07:20:34 +00:00
Move png_chunk_type to rpng_decode_common.h
This commit is contained in:
parent
f9fcbb7bb2
commit
b08176ae00
@ -78,27 +78,5 @@ static INLINE uint32_t dword_be(const uint8_t *buf)
|
|||||||
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | (buf[3] << 0);
|
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | (buf[3] << 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE enum png_chunk_type png_chunk_type(const struct png_chunk *chunk)
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
const char *id;
|
|
||||||
enum png_chunk_type type;
|
|
||||||
} static const chunk_map[] = {
|
|
||||||
{ "IHDR", PNG_CHUNK_IHDR },
|
|
||||||
{ "IDAT", PNG_CHUNK_IDAT },
|
|
||||||
{ "IEND", PNG_CHUNK_IEND },
|
|
||||||
{ "PLTE", PNG_CHUNK_PLTE },
|
|
||||||
};
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(chunk_map); i++)
|
|
||||||
{
|
|
||||||
if (memcmp(chunk->type, chunk_map[i].id, 4) == 0)
|
|
||||||
return chunk_map[i].type;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PNG_CHUNK_NOOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,6 +23,29 @@
|
|||||||
#ifndef _RPNG_DECODE_COMMON_H
|
#ifndef _RPNG_DECODE_COMMON_H
|
||||||
#define _RPNG_DECODE_COMMON_H
|
#define _RPNG_DECODE_COMMON_H
|
||||||
|
|
||||||
|
static enum png_chunk_type png_chunk_type(const struct png_chunk *chunk)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const char *id;
|
||||||
|
enum png_chunk_type type;
|
||||||
|
} static const chunk_map[] = {
|
||||||
|
{ "IHDR", PNG_CHUNK_IHDR },
|
||||||
|
{ "IDAT", PNG_CHUNK_IDAT },
|
||||||
|
{ "IEND", PNG_CHUNK_IEND },
|
||||||
|
{ "PLTE", PNG_CHUNK_PLTE },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(chunk_map); i++)
|
||||||
|
{
|
||||||
|
if (memcmp(chunk->type, chunk_map[i].id, 4) == 0)
|
||||||
|
return chunk_map[i].type;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PNG_CHUNK_NOOP;
|
||||||
|
}
|
||||||
|
|
||||||
static void copy_line_rgb(uint32_t *data,
|
static void copy_line_rgb(uint32_t *data,
|
||||||
const uint8_t *decoded, unsigned width, unsigned bpp)
|
const uint8_t *decoded, unsigned width, unsigned bpp)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user