mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-02 00:00:26 +02:00
Drop IrrCompileConfig (#163)
This commit is contained in:
@ -4,8 +4,6 @@
|
||||
|
||||
#include "CImageLoaderJPG.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_JPG_LOADER_
|
||||
|
||||
#include "IReadFile.h"
|
||||
#include "CImage.h"
|
||||
#include "os.h"
|
||||
@ -40,21 +38,18 @@ bool CImageLoaderJPG::isALoadableFileExtension(const io::path& filename) const
|
||||
return core::hasFileExtension ( filename, "jpg", "jpeg" );
|
||||
}
|
||||
|
||||
// struct for handling jpeg errors
|
||||
struct irr_jpeg_error_mgr
|
||||
{
|
||||
// public jpeg error fields
|
||||
struct jpeg_error_mgr pub;
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_LIBJPEG_
|
||||
// for longjmp, to return to caller on a fatal error
|
||||
jmp_buf setjmp_buffer;
|
||||
|
||||
// struct for handling jpeg errors
|
||||
struct irr_jpeg_error_mgr
|
||||
{
|
||||
// public jpeg error fields
|
||||
struct jpeg_error_mgr pub;
|
||||
|
||||
// for longjmp, to return to caller on a fatal error
|
||||
jmp_buf setjmp_buffer;
|
||||
|
||||
// for having access to the filename when printing the error messages
|
||||
core::stringc* filename;
|
||||
};
|
||||
// for having access to the filename when printing the error messages
|
||||
core::stringc* filename;
|
||||
};
|
||||
|
||||
void CImageLoaderJPG::init_source (j_decompress_ptr cinfo)
|
||||
{
|
||||
@ -116,31 +111,20 @@ void CImageLoaderJPG::output_message(j_common_ptr cinfo)
|
||||
errMsg += *myerr->filename;
|
||||
os::Printer::log(errMsg.c_str(),temp1, ELL_ERROR);
|
||||
}
|
||||
#endif // _IRR_COMPILE_WITH_LIBJPEG_
|
||||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
bool CImageLoaderJPG::isALoadableFileFormat(io::IReadFile* file) const
|
||||
{
|
||||
#ifndef _IRR_COMPILE_WITH_LIBJPEG_
|
||||
return false;
|
||||
#else
|
||||
|
||||
if (!(file && file->seek(0)))
|
||||
return false;
|
||||
unsigned char header[3];
|
||||
size_t headerLen = file->read(header, sizeof(header));
|
||||
return headerLen >= 3 && !memcmp(header, "\xFF\xD8\xFF", 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
//! creates a surface from the file
|
||||
IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
|
||||
{
|
||||
#ifndef _IRR_COMPILE_WITH_LIBJPEG_
|
||||
os::Printer::log("Can't load as not compiled with _IRR_COMPILE_WITH_LIBJPEG_:", file->getFileName(), ELL_DEBUG);
|
||||
return 0;
|
||||
#else
|
||||
|
||||
if (!file)
|
||||
return 0;
|
||||
|
||||
@ -288,8 +272,6 @@ IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
|
||||
delete [] input;
|
||||
|
||||
return image;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -302,6 +284,3 @@ IImageLoader* createImageLoaderJPG()
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user