confuse at CCImage::getDataLen

confuse at CCImage::getDataLen
0.0 0


CCImage::getData return the memory’s size is
CCImage::getDataLen() * 4;( Is this correct?)
this is obscure! I can only found it through the CCImage source file.


Yes getDataLen() is implemented like this:
int getDataLen() { return m_nWidth * m_nHeight; }

So basically it just returns number of pixels not data length and yes you need to multiply it by 4 if your image is 32bit. I also think it is very confusing. Personally I think that this method should be deprecated and two new methods should be created:
getNumberOfPixels - should return exaclty the same what current getDataLen returns
getDataLength - should return number of bytes used by the image data

I hope cocos2d-x team can think about that.


@warning kFmtRawData only supports RGBA8888.
so, multiply 4 is ok.