Add define IRR_CASE_IIMAGE_COMPRESSED_FORMAT to help getting rid of a few more warnings.

Unlikely we ever support conversions with compressed image format.
Define is a bit ugly I guess, but nicest way I could think off.
Can probably be used in some image writers as well, have to check which support/don't support compressed formats first.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6042 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2020-01-04 18:42:12 +00:00
parent 66b24bb745
commit f1a3995965
3 changed files with 37 additions and 44 deletions

View File

@ -243,11 +243,11 @@ public:
++i; ++i;
if ( mipSize.Width == 1 && mipSize.Height == 1 && i < mipLevel) if ( mipSize.Width == 1 && mipSize.Height == 1 && i < mipLevel)
return 0; return 0;
} }
return MipMapsData + dataSize; return MipMapsData + dataSize;
} }
return 0; return 0;
} }
@ -470,25 +470,29 @@ public:
return imageSize; 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 //! check if this is compressed color format
static bool isCompressedFormat(const ECOLOR_FORMAT format) static bool isCompressedFormat(const ECOLOR_FORMAT format)
{ {
switch(format) switch(format)
{ {
case ECF_DXT1: IRR_CASE_IIMAGE_COMPRESSED_FORMAT
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:
return true; return true;
default: default:
return false; return false;

View File

@ -717,6 +717,9 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
case ECF_R8G8B8: case ECF_R8G8B8:
convert_A1R5G5B5toR8G8B8(sP, sN, dP); convert_A1R5G5B5toR8G8B8(sP, sN, dP);
break; break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
#ifndef _DEBUG #ifndef _DEBUG
default: default:
break; break;
@ -738,6 +741,9 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
case ECF_R8G8B8: case ECF_R8G8B8:
convert_R5G6B5toR8G8B8(sP, sN, dP); convert_R5G6B5toR8G8B8(sP, sN, dP);
break; break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
#ifndef _DEBUG #ifndef _DEBUG
default: default:
break; break;
@ -759,6 +765,9 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
case ECF_R8G8B8: case ECF_R8G8B8:
convert_A8R8G8B8toR8G8B8(sP, sN, dP); convert_A8R8G8B8toR8G8B8(sP, sN, dP);
break; break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
#ifndef _DEBUG #ifndef _DEBUG
default: default:
break; break;
@ -780,12 +789,18 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
case ECF_R8G8B8: case ECF_R8G8B8:
convert_R8G8B8toR8G8B8(sP, sN, dP); convert_R8G8B8toR8G8B8(sP, sN, dP);
break; break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
#ifndef _DEBUG #ifndef _DEBUG
default: default:
break; break;
#endif #endif
} }
break; break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
#ifndef _DEBUG #ifndef _DEBUG
default: default:
break; break;

View File

@ -74,20 +74,7 @@ void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend)
*dest = blend ? PixelBlend32 ( *dest, color.color ) : color.color; *dest = blend ? PixelBlend32 ( *dest, color.color ) : color.color;
} break; } break;
case ECF_DXT1: IRR_CASE_IIMAGE_COMPRESSED_FORMAT
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:
os::Printer::log("IImage::setPixel method doesn't work with compressed images.", ELL_WARNING); os::Printer::log("IImage::setPixel method doesn't work with compressed images.", ELL_WARNING);
return; return;
@ -123,20 +110,7 @@ SColor CImage::getPixel(u32 x, u32 y) const
return SColor(255,p[0],p[1],p[2]); return SColor(255,p[0],p[1],p[2]);
} }
case ECF_DXT1: IRR_CASE_IIMAGE_COMPRESSED_FORMAT
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:
os::Printer::log("IImage::getPixel method doesn't work with compressed images.", ELL_WARNING); os::Printer::log("IImage::getPixel method doesn't work with compressed images.", ELL_WARNING);
break; break;