REMOVE: png server dependency

This commit is contained in:
Kolyah35
2026-03-19 19:09:40 +03:00
parent bb181ca838
commit 193f63893d

View File

@@ -10,6 +10,7 @@ struct MemoryReader {
}; };
static void pngMemoryRead(png_structp pngPtr, png_bytep outBytes, png_size_t byteCountToRead) { static void pngMemoryRead(png_structp pngPtr, png_bytep outBytes, png_size_t byteCountToRead) {
#ifndef STANDALONE_SERVER
MemoryReader* reader = (MemoryReader*)png_get_io_ptr(pngPtr); MemoryReader* reader = (MemoryReader*)png_get_io_ptr(pngPtr);
if (!reader) if (!reader)
return; return;
@@ -21,10 +22,12 @@ static void pngMemoryRead(png_structp pngPtr, png_bytep outBytes, png_size_t byt
memcpy(outBytes, reader->data + reader->pos, byteCountToRead); memcpy(outBytes, reader->data + reader->pos, byteCountToRead);
reader->pos += byteCountToRead; reader->pos += byteCountToRead;
#endif
} }
TextureData loadPngFromMemory(const unsigned char* data, size_t size) { TextureData loadPngFromMemory(const unsigned char* data, size_t size) {
TextureData out; TextureData out;
#ifndef STANDALONE_SERVER
if (!data || size == 0) return out; if (!data || size == 0) return out;
png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
@@ -89,6 +92,7 @@ TextureData loadPngFromMemory(const unsigned char* data, size_t size) {
png_destroy_read_struct(&pngPtr, &infoPtr, NULL); png_destroy_read_struct(&pngPtr, &infoPtr, NULL);
delete[] rowPtrs; delete[] rowPtrs;
#endif
return out; return out;
} }