diff --git a/include/IImage.h b/include/IImage.h index f4b3dc0..26af329 100644 --- a/include/IImage.h +++ b/include/IImage.h @@ -243,11 +243,11 @@ public: ++i; if ( mipSize.Width == 1 && mipSize.Height == 1 && i < mipLevel) return 0; - } + } return MipMapsData + dataSize; } - + return 0; } @@ -470,25 +470,29 @@ public: return imageSize; } +// Define to check for all compressed image formats cases in a switch +#define IRR_CASE_IIMAGE_COMPRESSED_FORMAT\ + case ECF_DXT1:\ + case ECF_DXT2:\ + case ECF_DXT3:\ + case ECF_DXT4:\ + case ECF_DXT5:\ + case ECF_PVRTC_RGB2:\ + case ECF_PVRTC_ARGB2:\ + case ECF_PVRTC2_ARGB2:\ + case ECF_PVRTC_RGB4:\ + case ECF_PVRTC_ARGB4:\ + case ECF_PVRTC2_ARGB4:\ + case ECF_ETC1:\ + case ECF_ETC2_RGB:\ + case ECF_ETC2_ARGB: + //! check if this is compressed color format static bool isCompressedFormat(const ECOLOR_FORMAT format) { switch(format) { - case ECF_DXT1: - case ECF_DXT2: - case ECF_DXT3: - case ECF_DXT4: - case ECF_DXT5: - case ECF_PVRTC_RGB2: - case ECF_PVRTC_ARGB2: - case ECF_PVRTC2_ARGB2: - case ECF_PVRTC_RGB4: - case ECF_PVRTC_ARGB4: - case ECF_PVRTC2_ARGB4: - case ECF_ETC1: - case ECF_ETC2_RGB: - case ECF_ETC2_ARGB: + IRR_CASE_IIMAGE_COMPRESSED_FORMAT return true; default: return false; diff --git a/source/Irrlicht/CColorConverter.cpp b/source/Irrlicht/CColorConverter.cpp index 64da5bf..ddfbfdf 100644 --- a/source/Irrlicht/CColorConverter.cpp +++ b/source/Irrlicht/CColorConverter.cpp @@ -717,6 +717,9 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN case ECF_R8G8B8: convert_A1R5G5B5toR8G8B8(sP, sN, dP); break; + IRR_CASE_IIMAGE_COMPRESSED_FORMAT + os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING); + break; #ifndef _DEBUG default: break; @@ -738,6 +741,9 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN case ECF_R8G8B8: convert_R5G6B5toR8G8B8(sP, sN, dP); break; + IRR_CASE_IIMAGE_COMPRESSED_FORMAT + os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING); + break; #ifndef _DEBUG default: break; @@ -759,6 +765,9 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN case ECF_R8G8B8: convert_A8R8G8B8toR8G8B8(sP, sN, dP); break; + IRR_CASE_IIMAGE_COMPRESSED_FORMAT + os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING); + break; #ifndef _DEBUG default: break; @@ -780,12 +789,18 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN case ECF_R8G8B8: convert_R8G8B8toR8G8B8(sP, sN, dP); break; + IRR_CASE_IIMAGE_COMPRESSED_FORMAT + os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING); + break; #ifndef _DEBUG default: break; #endif } break; + IRR_CASE_IIMAGE_COMPRESSED_FORMAT + os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING); + break; #ifndef _DEBUG default: break; diff --git a/source/Irrlicht/CImage.cpp b/source/Irrlicht/CImage.cpp index 9a7e57e..59a23f8 100644 --- a/source/Irrlicht/CImage.cpp +++ b/source/Irrlicht/CImage.cpp @@ -74,20 +74,7 @@ void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend) *dest = blend ? PixelBlend32 ( *dest, color.color ) : color.color; } break; - case ECF_DXT1: - case ECF_DXT2: - case ECF_DXT3: - case ECF_DXT4: - case ECF_DXT5: - case ECF_PVRTC_RGB2: - case ECF_PVRTC_ARGB2: - case ECF_PVRTC2_ARGB2: - case ECF_PVRTC_RGB4: - case ECF_PVRTC_ARGB4: - case ECF_PVRTC2_ARGB4: - case ECF_ETC1: - case ECF_ETC2_RGB: - case ECF_ETC2_ARGB: + IRR_CASE_IIMAGE_COMPRESSED_FORMAT os::Printer::log("IImage::setPixel method doesn't work with compressed images.", ELL_WARNING); return; @@ -123,20 +110,7 @@ SColor CImage::getPixel(u32 x, u32 y) const return SColor(255,p[0],p[1],p[2]); } - case ECF_DXT1: - case ECF_DXT2: - case ECF_DXT3: - case ECF_DXT4: - case ECF_DXT5: - case ECF_PVRTC_RGB2: - case ECF_PVRTC_ARGB2: - case ECF_PVRTC2_ARGB2: - case ECF_PVRTC_RGB4: - case ECF_PVRTC_ARGB4: - case ECF_PVRTC2_ARGB4: - case ECF_ETC1: - case ECF_ETC2_RGB: - case ECF_ETC2_ARGB: + IRR_CASE_IIMAGE_COMPRESSED_FORMAT os::Printer::log("IImage::getPixel method doesn't work with compressed images.", ELL_WARNING); break;