Commit 5cd23141 authored by hybrid's avatar hybrid

Oops, misread the switch. Alpha representation always requires 32bit, so...

Oops, misread the switch. Alpha representation always requires 32bit, so reverted to original code with just another empty default statement.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4029 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 9ce25254
...@@ -123,8 +123,22 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param) ...@@ -123,8 +123,22 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param)
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
} }
s32 lineWidth=image->getDimension().Width; s32 lineWidth = image->getDimension().Width;
u8* tmpImage = new u8[image->getDimension().Height*lineWidth*image->getBytesPerPixel()]; switch(image->getColorFormat())
{
case ECF_R8G8B8:
case ECF_R5G6B5:
lineWidth*=3;
break;
case ECF_A8R8G8B8:
case ECF_A1R5G5B5:
lineWidth*=4;
break;
// TODO: Error handling in case of unsupported color format
default:
break;
}
u8* tmpImage = new u8[image->getDimension().Height*lineWidth];
if (!tmpImage) if (!tmpImage)
{ {
os::Printer::log("PNGWriter: Internal PNG create image failure\n", file->getFileName(), ELL_ERROR); os::Printer::log("PNGWriter: Internal PNG create image failure\n", file->getFileName(), ELL_ERROR);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment