mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
b0a4b6a1ee
https://kristerw.blogspot.com/2016/02/how-undefined-signed-overflow-enables.html Doing this as cleanly as possible involved demoting several function parameters concerning object sizes and counts from size_t to int--I'm fine with this change as the functions in question are not actually capable of handling input with sizes larger than what can be stored in a signed 32-bit integer, making the use of size_t here misleading at best. git-svn-id: https://svn.eduke32.com/eduke32@7673 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/polymost.cpp # source/build/src/texcache.cpp # source/build/src/tilepacker.cpp
39 lines
739 B
C
39 lines
739 B
C
#ifndef __PNGWRITE_H__
|
|
#define __PNGWRITE_H__
|
|
|
|
#include "miniz.h"
|
|
|
|
#include "vfs.h"
|
|
|
|
#define CHUNK_COMPRESSED 1
|
|
#define CHUNK_ROW 2
|
|
|
|
enum
|
|
{
|
|
PNG_TRUECOLOR = 2,
|
|
PNG_INDEXED = 3,
|
|
};
|
|
|
|
#pragma pack(push, 1)
|
|
typedef struct
|
|
{
|
|
z_stream *zs;
|
|
buildvfs_FILE file;
|
|
uint8_t *pal_data;
|
|
uint16_t pal_entries;
|
|
uint8_t *text;
|
|
uint8_t textlen;
|
|
} pngwrite_t;
|
|
|
|
typedef struct
|
|
{
|
|
uint32_t width, height;
|
|
uint8_t depth, type, filler[3];
|
|
} png_ihdr_t;
|
|
#pragma pack(pop)
|
|
|
|
void png_set_pal(uint8_t const * data, int numentries);
|
|
void png_set_text(char const * keyword, char const * text);
|
|
void png_write(buildvfs_FILE const file, int const width, int const height, uint8_t const type, uint8_t const * const data);
|
|
|
|
#endif
|