mirror of https://github.com/axmolengine/axmol.git
remove RGB565 support
This commit is contained in:
parent
d9ef93bbe5
commit
37a0f19c46
|
@ -42,51 +42,27 @@ bool CCImage::_initWithWebpData(void *pData, int nDataLen)
|
|||
if (WebPGetFeatures((uint8_t*)pData, nDataLen, &config.input) != VP8_STATUS_OK) break;
|
||||
if (config.input.width == 0 || config.input.height == 0) break;
|
||||
|
||||
CCTexture2DPixelFormat destFormat = CCTexture2D::defaultAlphaPixelFormat();
|
||||
switch (destFormat)
|
||||
{
|
||||
case kTexture2DPixelFormat_RGB888:
|
||||
config.output.colorspace = MODE_RGB;
|
||||
break;
|
||||
|
||||
case kTexture2DPixelFormat_RGB565:
|
||||
config.output.colorspace = MODE_RGB_565;
|
||||
break;
|
||||
|
||||
case kTexture2DPixelFormat_RGBA4444:
|
||||
config.output.colorspace = MODE_RGBA_4444;
|
||||
break;
|
||||
|
||||
case kTexture2DPixelFormat_A8:
|
||||
case kTexture2DPixelFormat_RGB5A1:
|
||||
CCAssert(false, "kTexture2DPixelFormat_A8/kTexture2DPixelFormat_RGB5A1 not support");
|
||||
break;
|
||||
|
||||
case kTexture2DPixelFormat_RGBA8888:
|
||||
default:
|
||||
config.output.colorspace = MODE_RGBA;
|
||||
break;
|
||||
}
|
||||
|
||||
config.output.colorspace = MODE_RGBA;
|
||||
m_nBitsPerComponent = 8;
|
||||
m_nWidth = config.input.width;
|
||||
m_nHeight = config.input.height;
|
||||
m_bHasAlpha = config.input.has_alpha;
|
||||
m_bHasAlpha = true;
|
||||
|
||||
int bufferSize = m_nWidth * m_nHeight * 4;
|
||||
m_pData = new unsigned char[bufferSize];
|
||||
|
||||
config.output.u.RGBA.rgba = (uint8_t*)m_pData;
|
||||
config.output.u.RGBA.stride = m_nWidth;
|
||||
config.output.u.RGBA.stride = m_nWidth * 4;
|
||||
config.output.u.RGBA.size = bufferSize;
|
||||
config.output.is_external_memory = 1;
|
||||
|
||||
|
||||
if (WebPDecode((uint8_t*)pData, nDataLen, &config) != VP8_STATUS_OK)
|
||||
{
|
||||
delete []m_pData;
|
||||
m_pData = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
bRet = true;
|
||||
} while (0);
|
||||
return bRet;
|
||||
|
|
Loading…
Reference in New Issue