mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-01 15:50:27 +02:00
Drop IrrCompileConfig (#163)
This commit is contained in:
@ -4,11 +4,7 @@
|
||||
|
||||
#include "CImageLoaderPNG.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_PNG_LOADER_
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_LIBPNG_
|
||||
#include <png.h> // use system lib png
|
||||
#endif // _IRR_COMPILE_WITH_LIBPNG_
|
||||
#include <png.h> // use system lib png
|
||||
|
||||
#include "CImage.h"
|
||||
#include "CReadFile.h"
|
||||
@ -19,7 +15,6 @@ namespace irr
|
||||
namespace video
|
||||
{
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_LIBPNG_
|
||||
// PNG function for error handling
|
||||
static void png_cpexcept_error(png_structp png_ptr, png_const_charp msg)
|
||||
{
|
||||
@ -46,25 +41,19 @@ void PNGAPI user_read_data_fcn(png_structp png_ptr, png_bytep data, png_size_t l
|
||||
if (check != length)
|
||||
png_error(png_ptr, "Read Error");
|
||||
}
|
||||
#endif // _IRR_COMPILE_WITH_LIBPNG_
|
||||
|
||||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
//! based on the file extension (e.g. ".tga")
|
||||
bool CImageLoaderPng::isALoadableFileExtension(const io::path& filename) const
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_LIBPNG_
|
||||
return core::hasFileExtension ( filename, "png" );
|
||||
#else
|
||||
return false;
|
||||
#endif // _IRR_COMPILE_WITH_LIBPNG_
|
||||
}
|
||||
|
||||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
bool CImageLoaderPng::isALoadableFileFormat(io::IReadFile* file) const
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_LIBPNG_
|
||||
if (!file)
|
||||
return false;
|
||||
|
||||
@ -75,16 +64,12 @@ bool CImageLoaderPng::isALoadableFileFormat(io::IReadFile* file) const
|
||||
|
||||
// Check if it really is a PNG file
|
||||
return !png_sig_cmp(buffer, 0, 8);
|
||||
#else
|
||||
return false;
|
||||
#endif // _IRR_COMPILE_WITH_LIBPNG_
|
||||
}
|
||||
|
||||
|
||||
// load in the image data
|
||||
IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_LIBPNG_
|
||||
if (!file)
|
||||
return 0;
|
||||
|
||||
@ -267,9 +252,6 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
|
||||
png_destroy_read_struct(&png_ptr,&info_ptr, 0); // Clean up memory
|
||||
|
||||
return image;
|
||||
#else
|
||||
return 0;
|
||||
#endif // _IRR_COMPILE_WITH_LIBPNG_
|
||||
}
|
||||
|
||||
|
||||
@ -281,6 +263,3 @@ IImageLoader* createImageLoaderPNG()
|
||||
|
||||
}// end namespace irr
|
||||
}//end namespace video
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user