From 87913aa62de0edfcbde9d9fdb938968d1b511a5f Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 28 Jan 2024 17:12:48 +0100 Subject: Public: Refactor and cleaned up Public/ folder. - Many cleanups and new emerging APIs (GPUKit, SystemKit) Signed-off-by: Amlal El Mahrouss --- Public/SDK/SystemKit/MePNG.cpp | 90 ------------------------------------------ 1 file changed, 90 deletions(-) delete mode 100644 Public/SDK/SystemKit/MePNG.cpp (limited to 'Public/SDK/SystemKit/MePNG.cpp') diff --git a/Public/SDK/SystemKit/MePNG.cpp b/Public/SDK/SystemKit/MePNG.cpp deleted file mode 100644 index d43393e0..00000000 --- a/Public/SDK/SystemKit/MePNG.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * ======================================================== - * - * h-core - * Copyright Mahrouss Logic, all rights reserved. - * - * ======================================================== - */ - -#include -#include -#include -#include - -static const char* png_error_to_str(const int err); - -enum -{ - kPngErrAdler, - kPngErrCrc, - kPngErrCompr, - kPngUnknown, -}; - -typedef void* PNGImage; - -static const char* png_error_to_str(const int err) -{ - switch (err) - { - case kPngErrAdler: - return "PNG: Bad adler32."; - case kPngErrCompr: - return "PngLin: Bad compression."; - case kPngErrCrc: - return "PNG: Bad CRC32."; - case kPngUnknown: - default: - return "PNG: Error while loading image."; - } - - return "PNG: Unknown error."; -} - -class PngHeader final -{ -public: - UInt8 Mag1; - Char* Mag2; - UInt16 DosDetect; - UInt16 DosEOF; - UInt16 UnixLF; - -}; - -#define kIHDRMag "IHDR" -#define kIDATMag "IDAT" -#define kIENDMag "IEND" - -MeFilePtr png_open_file(const char* path) -{ - MeFilePtr thePng = new MeFile(path); - - thePng->SetMIME("image/png"); - thePng->Rewind(); - - return thePng; -} - -static h-core::Ref png_read_header(MeFilePtr thePng) -{ - if (thePng) - { - h-core::Ref header; - - header.Leak().Mag1 = *(UInt8*)thePng->Read(sizeof(UInt8)); - - h-core::rt_copy_memory((h-core::voidPtr)header.Leak().Mag2, - (h-core::voidPtr)thePng->Read(h-core::string_length("PNG")), - h-core::string_length("PNG")); - - header.Leak().DosDetect = *(UInt16*)thePng->Read(sizeof(UInt16)); - header.Leak().DosEOF = *(UInt16*)thePng->Read(sizeof(UInt16)); - header.Leak().UnixLF = *(UInt16*)thePng->Read(sizeof(UInt16)); - - return header; - } - - return h-core::Ref{ }; -} -- cgit v1.2.3