mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-10 09:43:52 +01:00
Avoid some warnings and unnecessary (slow) check in CImage::setPixel/getPixel
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6041 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
229c827870
commit
66b24bb745
@ -43,12 +43,6 @@ CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) : IImag
|
||||
//! sets a pixel
|
||||
void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend)
|
||||
{
|
||||
if (IImage::isCompressedFormat(Format))
|
||||
{
|
||||
os::Printer::log("IImage::setPixel method doesn't work with compressed images.", ELL_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (x >= Size.Width || y >= Size.Height)
|
||||
return;
|
||||
|
||||
@ -79,6 +73,28 @@ void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend)
|
||||
u32 * dest = (u32*) (Data + ( y * Pitch ) + ( x << 2 ));
|
||||
*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:
|
||||
os::Printer::log("IImage::setPixel method doesn't work with compressed images.", ELL_WARNING);
|
||||
return;
|
||||
|
||||
case ECF_UNKNOWN:
|
||||
os::Printer::log("IImage::setPixel unknown format.", ELL_WARNING);
|
||||
return;
|
||||
|
||||
#ifndef _DEBUG
|
||||
default:
|
||||
break;
|
||||
@ -90,12 +106,6 @@ void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend)
|
||||
//! returns a pixel
|
||||
SColor CImage::getPixel(u32 x, u32 y) const
|
||||
{
|
||||
if (IImage::isCompressedFormat(Format))
|
||||
{
|
||||
os::Printer::log("IImage::getPixel method doesn't work with compressed images.", ELL_WARNING);
|
||||
return SColor(0);
|
||||
}
|
||||
|
||||
if (x >= Size.Width || y >= Size.Height)
|
||||
return SColor(0);
|
||||
|
||||
@ -112,6 +122,28 @@ SColor CImage::getPixel(u32 x, u32 y) const
|
||||
u8* p = Data+(y*3)*Size.Width + (x*3);
|
||||
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:
|
||||
os::Printer::log("IImage::getPixel method doesn't work with compressed images.", ELL_WARNING);
|
||||
break;
|
||||
|
||||
case ECF_UNKNOWN:
|
||||
os::Printer::log("IImage::getPixel unknown format.", ELL_WARNING);
|
||||
break;
|
||||
|
||||
#ifndef _DEBUG
|
||||
default:
|
||||
break;
|
||||
@ -131,7 +163,7 @@ void CImage::copyTo(IImage* target, const core::position2d<s32>& pos)
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !Blit(BLITTER_TEXTURE, target, 0, &pos, this, 0, 0)
|
||||
if ( !Blit(BLITTER_TEXTURE, target, 0, &pos, this, 0, 0)
|
||||
&& target && pos.X == 0 && pos.Y == 0 &&
|
||||
CColorConverter::canConvertFormat(Format, target->getColorFormat()) )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user