mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 19:20:46 +00:00
- updated m_png.cpp from GZDoom.
This commit is contained in:
parent
1d7bfe14dc
commit
edcfad6e11
1 changed files with 20 additions and 9 deletions
|
@ -102,9 +102,6 @@ static void UnpackPixels (int width, int bytesPerRow, int bitdepth, const uint8_
|
||||||
|
|
||||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||||
|
|
||||||
int png_level = 5;
|
|
||||||
int png_gamma = 0;
|
|
||||||
/*
|
|
||||||
CUSTOM_CVAR(Int, png_level, 5, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CUSTOM_CVAR(Int, png_level, 5, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
{
|
{
|
||||||
if (self < 0)
|
if (self < 0)
|
||||||
|
@ -113,7 +110,7 @@ CUSTOM_CVAR(Int, png_level, 5, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
self = 9;
|
self = 9;
|
||||||
}
|
}
|
||||||
CVAR(Float, png_gamma, 0.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR(Float, png_gamma, 0.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
*/
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
@ -763,7 +760,7 @@ uint32_t CalcSum(Byte *row, int len)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
#if USE_FILTER_HEURISTIC
|
#if USE_FILTER_HEURISTIC
|
||||||
static int SelectFilter(Byte row[5][1 + MAXWIDTH*3], Byte prior[MAXWIDTH*3], int width)
|
static int SelectFilter(Byte **row, Byte *prior, int width)
|
||||||
{
|
{
|
||||||
// As it turns out, it seems no filtering is the best for Doom screenshots,
|
// As it turns out, it seems no filtering is the best for Doom screenshots,
|
||||||
// no matter what the heuristic might determine.
|
// no matter what the heuristic might determine.
|
||||||
|
@ -898,13 +895,27 @@ static int SelectFilter(Byte row[5][1 + MAXWIDTH*3], Byte prior[MAXWIDTH*3], int
|
||||||
|
|
||||||
bool M_SaveBitmap(const uint8_t *from, ESSType color_type, int width, int height, int pitch, FileWriter *file)
|
bool M_SaveBitmap(const uint8_t *from, ESSType color_type, int width, int height, int pitch, FileWriter *file)
|
||||||
{
|
{
|
||||||
#define MAXWIDTH 2048
|
TArray<Byte> temprow_storage;
|
||||||
|
|
||||||
#if USE_FILTER_HEURISTIC
|
#if USE_FILTER_HEURISTIC
|
||||||
Byte prior[MAXWIDTH*3];
|
static const unsigned temprow_count = 5;
|
||||||
Byte temprow[5][1 + MAXWIDTH*3];
|
|
||||||
|
TArray<Byte> prior_storage(width * 3, true);
|
||||||
|
Byte *prior = &prior_storage[0];
|
||||||
#else
|
#else
|
||||||
Byte temprow[1][1 + MAXWIDTH*3];
|
static const unsigned temprow_count = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const unsigned temprow_size = 1 + width * 3;
|
||||||
|
temprow_storage.Resize(temprow_size * temprow_count);
|
||||||
|
|
||||||
|
Byte* temprow[temprow_count];
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < temprow_count; ++i)
|
||||||
|
{
|
||||||
|
temprow[i] = &temprow_storage[temprow_size * i];
|
||||||
|
}
|
||||||
|
|
||||||
Byte buffer[PNG_WRITE_SIZE];
|
Byte buffer[PNG_WRITE_SIZE];
|
||||||
z_stream stream;
|
z_stream stream;
|
||||||
int err;
|
int err;
|
||||||
|
|
Loading…
Reference in a new issue