mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
(RPNG) Reorganize files
This commit is contained in:
parent
53a788f95a
commit
ce4e2e0f61
@ -594,8 +594,9 @@ endif
|
||||
|
||||
ifeq ($(HAVE_ZLIB), 1)
|
||||
ZLIB_OBJS = decompress/zip_support.o
|
||||
OBJ += libretro-common/formats/png/rpng_decode_fnbio.o \
|
||||
libretro-common/formats/png/rpng_decode_fbio.o \
|
||||
OBJ += libretro-common/formats/png/rpng_nbio.o \
|
||||
libretro-common/formats/png/rpng_fbio.o \
|
||||
libretro-common/formats/png/rpng_decode.o \
|
||||
libretro-common/formats/png/rpng_encode.o \
|
||||
file_extract.o
|
||||
OBJ += $(ZLIB_OBJS)
|
||||
|
@ -171,8 +171,9 @@ VIDEO IMAGE
|
||||
#include "../gfx/image/image.c"
|
||||
|
||||
#include "../libretro-common/formats/tga/tga_decode.c"
|
||||
#include "../libretro-common/formats/png/rpng_decode_fbio.c"
|
||||
#include "../libretro-common/formats/png/rpng_decode_fnbio.c"
|
||||
#include "../libretro-common/formats/png/rpng_fbio.c"
|
||||
#include "../libretro-common/formats/png/rpng_nbio.c"
|
||||
#include "../libretro-common/formats/png/rpng_decode.c"
|
||||
#include "../libretro-common/formats/png/rpng_encode.c"
|
||||
|
||||
/*============================================================
|
||||
|
@ -8,7 +8,7 @@ CFLAGS += -DHAVE_IMLIB2
|
||||
LDFLAGS += -lImlib2
|
||||
endif
|
||||
|
||||
SOURCES := rpng_decode_fbio.c rpng_decode_fnbio.c rpng_encode.c rpng_test.c ../../file/nbio/nbio_stdio.c
|
||||
SOURCES := rpng_fbio.c rpng_nbio.c rpng_encode.c rpng_decode.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
|
||||
|
@ -20,10 +20,16 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _RPNG_DECODE_COMMON_H
|
||||
#define _RPNG_DECODE_COMMON_H
|
||||
#include <formats/rpng.h>
|
||||
|
||||
static enum png_chunk_type png_chunk_type(const struct png_chunk *chunk)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "rpng_common.h"
|
||||
#include "rpng_decode.h"
|
||||
|
||||
enum png_chunk_type png_chunk_type(const struct png_chunk *chunk)
|
||||
{
|
||||
unsigned i;
|
||||
struct
|
||||
@ -46,7 +52,7 @@ static enum png_chunk_type png_chunk_type(const struct png_chunk *chunk)
|
||||
return PNG_CHUNK_NOOP;
|
||||
}
|
||||
|
||||
static bool png_process_ihdr(struct png_ihdr *ihdr)
|
||||
bool png_process_ihdr(struct png_ihdr *ihdr)
|
||||
{
|
||||
unsigned i;
|
||||
bool ret = true;
|
||||
@ -230,7 +236,7 @@ static void png_reverse_filter_copy_line_plt(uint32_t *data,
|
||||
}
|
||||
}
|
||||
|
||||
static void png_pass_geom(const struct png_ihdr *ihdr,
|
||||
void png_pass_geom(const struct png_ihdr *ihdr,
|
||||
unsigned width, unsigned height,
|
||||
unsigned *bpp_out, unsigned *pitch_out, size_t *pass_size)
|
||||
{
|
||||
@ -323,7 +329,7 @@ enum png_process_code
|
||||
PNG_PROCESS_END = 1,
|
||||
};
|
||||
|
||||
static int png_reverse_filter_init(const struct png_ihdr *ihdr,
|
||||
int png_reverse_filter_init(const struct png_ihdr *ihdr,
|
||||
struct rpng_process_t *pngp)
|
||||
{
|
||||
size_t pass_size;
|
||||
@ -389,8 +395,6 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int png_reverse_filter_copy_line(uint32_t *data, const struct png_ihdr *ihdr,
|
||||
struct rpng_process_t *pngp, unsigned filter)
|
||||
{
|
||||
@ -461,7 +465,6 @@ static int png_reverse_filter_copy_line(uint32_t *data, const struct png_ihdr *i
|
||||
return PNG_PROCESS_NEXT;
|
||||
}
|
||||
|
||||
|
||||
static int png_reverse_filter_iterate(uint32_t *data, const struct png_ihdr *ihdr,
|
||||
struct rpng_process_t *pngp)
|
||||
{
|
||||
@ -488,11 +491,10 @@ static int png_reverse_filter_iterate(uint32_t *data, const struct png_ihdr *ihd
|
||||
return PNG_PROCESS_NEXT;
|
||||
}
|
||||
|
||||
|
||||
static int png_reverse_filter_regular_loop(uint32_t **data_, const struct png_ihdr *ihdr,
|
||||
int png_reverse_filter_regular_loop(uint32_t **data, const struct png_ihdr *ihdr,
|
||||
struct rpng_process_t *pngp)
|
||||
{
|
||||
int ret = png_reverse_filter_iterate(*data_, ihdr, pngp);
|
||||
int ret = png_reverse_filter_iterate(*data, ihdr, pngp);
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
@ -501,19 +503,18 @@ static int png_reverse_filter_regular_loop(uint32_t **data_, const struct png_ih
|
||||
case PNG_PROCESS_END:
|
||||
break;
|
||||
case PNG_PROCESS_NEXT:
|
||||
*data_ += ihdr->width;
|
||||
*data += ihdr->width;
|
||||
pngp->data_restore_buf_size += ihdr->width;
|
||||
return PNG_PROCESS_NEXT;
|
||||
}
|
||||
|
||||
pngp->inflate_buf -= pngp->restore_buf_size;
|
||||
*data_ -= pngp->data_restore_buf_size;
|
||||
*data -= pngp->data_restore_buf_size;
|
||||
pngp->data_restore_buf_size = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int png_reverse_filter_adam7_iterate(uint32_t **data_,
|
||||
const struct png_ihdr *ihdr,
|
||||
struct rpng_process_t *pngp)
|
||||
@ -560,7 +561,7 @@ static int png_reverse_filter_adam7_iterate(uint32_t **data_,
|
||||
return PNG_PROCESS_NEXT;
|
||||
}
|
||||
|
||||
static int png_reverse_filter_adam7(uint32_t **data_,
|
||||
int png_reverse_filter_adam7(uint32_t **data_,
|
||||
const struct png_ihdr *ihdr,
|
||||
struct rpng_process_t *pngp)
|
||||
{
|
||||
@ -588,7 +589,7 @@ static int png_reverse_filter_adam7(uint32_t **data_,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool png_reverse_filter_loop(struct rpng_t *rpng,
|
||||
bool png_reverse_filter_loop(struct rpng_t *rpng,
|
||||
uint32_t **data)
|
||||
{
|
||||
int ret = 0;
|
||||
@ -625,5 +626,3 @@ static bool png_reverse_filter_loop(struct rpng_t *rpng,
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
48
libretro-common/formats/png/rpng_decode.h
Normal file
48
libretro-common/formats/png/rpng_decode.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* Copyright (C) 2010-2015 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rpng.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _RPNG_DECODE_H
|
||||
#define _RPNG_DECODE_H
|
||||
|
||||
enum png_chunk_type png_chunk_type(const struct png_chunk *chunk);
|
||||
|
||||
void png_pass_geom(const struct png_ihdr *ihdr,
|
||||
unsigned width, unsigned height,
|
||||
unsigned *bpp_out, unsigned *pitch_out, size_t *pass_size);
|
||||
|
||||
bool png_process_ihdr(struct png_ihdr *ihdr);
|
||||
|
||||
int png_reverse_filter_init(const struct png_ihdr *ihdr,
|
||||
struct rpng_process_t *pngp);
|
||||
|
||||
int png_reverse_filter_adam7(uint32_t **data,
|
||||
const struct png_ihdr *ihdr,
|
||||
struct rpng_process_t *pngp);
|
||||
|
||||
int png_reverse_filter_regular_loop(uint32_t **data,
|
||||
const struct png_ihdr *ihdr,
|
||||
struct rpng_process_t *pngp);
|
||||
|
||||
bool png_reverse_filter_loop(struct rpng_t *rpng,
|
||||
uint32_t **data);
|
||||
|
||||
#endif
|
@ -31,7 +31,7 @@
|
||||
#endif
|
||||
|
||||
#include "rpng_common.h"
|
||||
#include "rpng_decode_common.h"
|
||||
#include "rpng_decode.h"
|
||||
|
||||
static bool read_chunk_header_fio(FILE *file, struct png_chunk *chunk)
|
||||
{
|
||||
@ -78,9 +78,6 @@ static void png_free_chunk(struct png_chunk *chunk)
|
||||
static bool png_parse_ihdr_fio(FILE *file,
|
||||
struct png_chunk *chunk, struct png_ihdr *ihdr)
|
||||
{
|
||||
unsigned i;
|
||||
bool ret = true;
|
||||
|
||||
if (!png_read_chunk(file, chunk))
|
||||
return false;
|
||||
|
@ -31,7 +31,7 @@
|
||||
#endif
|
||||
|
||||
#include "rpng_common.h"
|
||||
#include "rpng_decode_common.h"
|
||||
#include "rpng_decode.h"
|
||||
|
||||
static bool read_chunk_header(uint8_t *buf, struct png_chunk *chunk)
|
||||
{
|
||||
@ -56,8 +56,6 @@ static bool read_chunk_header(uint8_t *buf, struct png_chunk *chunk)
|
||||
static bool png_parse_ihdr(uint8_t *buf,
|
||||
struct png_ihdr *ihdr)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
buf += 4 + 4;
|
||||
|
||||
ihdr->width = dword_be(buf + 0);
|
Loading…
x
Reference in New Issue
Block a user