- cleaned up the includes in m_png.h, this file had far too many and far too broad dependencies.

This commit is contained in:
Christoph Oelckers 2020-04-11 12:25:57 +02:00
parent cc48f18303
commit 1fe667c6a0
13 changed files with 34 additions and 16 deletions

View file

@ -202,14 +202,6 @@ enum class ELightMode : int8_t
DoomSoftware = 16
};
// Screenshot buffer image data types
enum ESSType
{
SS_PAL,
SS_RGB,
SS_BGRA
};
// always use our own definition for consistency.
#ifdef M_PI
#undef M_PI

View file

@ -75,6 +75,7 @@
#include "i_system.h"
#include "p_conversation.h"
#include "v_video.h"
#include "g_hub.h"
#include "g_levellocals.h"
#include "events.h"

View file

@ -41,6 +41,7 @@
#include "bitmap.h"
#include "imagehelpers.h"
#include "image.h"
#include "textures.h"
//==========================================================================
//

View file

@ -2,6 +2,7 @@
#include <stdint.h>
#include "tarray.h"
#include "textures.h"
#include "textures/bitmap.h"
#include "memarena.h"

View file

@ -41,6 +41,7 @@
#include "tarray.h"
#include "colormatcher.h"
#include "v_palette.h"
#include "v_colortables.h"
#include "textures/bitmap.h"
#include "r_data/renderstyle.h"
#include "r_data/r_translate.h"

View file

@ -43,6 +43,7 @@
#include "serializer.h"
#include "vm.h"
#include "i_system.h"
#include "v_video.h"
// Save name length limit for old binary formats.
#define OLDSAVESTRINGSIZE 24

View file

@ -75,6 +75,7 @@
#include "types.h"
#include "scriptutil.h"
#include "s_music.h"
#include "v_video.h"
// P-codes for ACS scripts
enum

View file

@ -2,6 +2,7 @@
#define __GL_FRAMEBUFFER
#include "gl_sysfb.h"
#include "m_png.h"
#include <memory>

View file

@ -26,6 +26,7 @@
#include "stats.h"
#include "r_utility.h"
#include "c_dispatch.h"
#include "v_video.h"
#include "hw_ihwtexture.h"
#include "hw_material.h"

View file

@ -39,6 +39,7 @@
#include "vectors.h"
#include "doomdef.h"
#include "m_png.h"
#include "dobject.h"
#include "r_data/renderstyle.h"
#include "c_cvars.h"

View file

@ -33,7 +33,7 @@
*/
#include <zlib.h>
#include "basics.h"
#include <stdint.h>
// zlib includes some CRC32 stuff, so just use that
@ -50,3 +50,8 @@ inline uint32_t CRC1 (uint32_t crc, const uint8_t c, const uint32_t *crcTable)
{
return crcTable[(crc & 0xff) ^ c] ^ (crc >> 8);
}
inline uint32_t Bcrc32(const void* data, int length, uint32_t crc)
{
return crc32(crc, (const Bytef*)data, length);
}

View file

@ -34,18 +34,21 @@
// HEADER FILES ------------------------------------------------------------
#include <algorithm>
#include <stdlib.h>
#include <zlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <malloc.h> // for alloca()
#endif
#include "basics.h"
#include "m_crc32.h"
#include "m_swap.h"
#include "c_cvars.h"
#include "r_defs.h"
#include "m_png.h"
// MACROS ------------------------------------------------------------------
// The maximum size of an IDAT chunk ZDoom will write. This is also the
@ -243,7 +246,7 @@ bool M_AppendPNGText (FileWriter *file, const char *keyword, const char *text)
{
struct { uint32_t len, id; char key[80]; } head;
int len = (int)strlen (text);
int keylen = MIN ((int)strlen (keyword), 79);
int keylen = std::min ((int)strlen (keyword), 79);
uint32_t crc;
head.len = BigLong(len + keylen + 1);
@ -326,7 +329,7 @@ char *M_GetPNGText (PNGHandle *png, const char *keyword)
if (strncmp (keyword, png->TextChunks[i], 80) == 0)
{
// Woo! A match was found!
keylen = MIN<size_t> (80, strlen (keyword) + 1);
keylen = std::min<size_t> (80, strlen (keyword) + 1);
textlen = strlen (png->TextChunks[i] + keylen) + 1;
char *str = new char[textlen];
strcpy (str, png->TextChunks[i] + keylen);
@ -348,7 +351,7 @@ bool M_GetPNGText (PNGHandle *png, const char *keyword, char *buffer, size_t buf
if (strncmp (keyword, png->TextChunks[i], 80) == 0)
{
// Woo! A match was found!
keylen = MIN<size_t> (80, strlen (keyword) + 1);
keylen = std::min<size_t> (80, strlen (keyword) + 1);
strncpy (buffer, png->TextChunks[i] + keylen, buffsize);
return true;
}
@ -563,7 +566,7 @@ bool M_ReadIDAT (FileReader &file, uint8_t *buffer, int width, int height, int p
if (stream.avail_in == 0 && chunklen > 0)
{
stream.next_in = chunkbuffer;
stream.avail_in = (uInt)file.Read (chunkbuffer, MIN<uint32_t>(chunklen,sizeof(chunkbuffer)));
stream.avail_in = (uInt)file.Read (chunkbuffer, std::min<uint32_t>(chunklen,sizeof(chunkbuffer)));
chunklen -= stream.avail_in;
}

View file

@ -34,9 +34,18 @@
*/
#include <stdio.h>
#include "doomtype.h"
#include "v_video.h"
#include "zstring.h"
#include "files.h"
#include "palentry.h"
#include "basics.h"
// Screenshot buffer image data types
enum ESSType
{
SS_PAL,
SS_RGB,
SS_BGRA
};
class FileWriter;
// PNG Writing --------------------------------------------------------------