diff --git a/source/Irrlicht/CImage.cpp b/source/Irrlicht/CImage.cpp index c6f5826..9a7e57e 100644 --- a/source/Irrlicht/CImage.cpp +++ b/source/Irrlicht/CImage.cpp @@ -43,12 +43,6 @@ CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d& 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& 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()) ) {