mirror of https://github.com/axmolengine/axmol.git
remove RGB565 support
This commit is contained in:
parent
d9ef93bbe5
commit
37a0f19c46
|
@ -42,41 +42,17 @@ bool CCImage::_initWithWebpData(void *pData, int nDataLen)
|
||||||
if (WebPGetFeatures((uint8_t*)pData, nDataLen, &config.input) != VP8_STATUS_OK) break;
|
if (WebPGetFeatures((uint8_t*)pData, nDataLen, &config.input) != VP8_STATUS_OK) break;
|
||||||
if (config.input.width == 0 || config.input.height == 0) 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;
|
config.output.colorspace = MODE_RGBA;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_nBitsPerComponent = 8;
|
m_nBitsPerComponent = 8;
|
||||||
m_nWidth = config.input.width;
|
m_nWidth = config.input.width;
|
||||||
m_nHeight = config.input.height;
|
m_nHeight = config.input.height;
|
||||||
m_bHasAlpha = config.input.has_alpha;
|
m_bHasAlpha = true;
|
||||||
|
|
||||||
int bufferSize = m_nWidth * m_nHeight * 4;
|
int bufferSize = m_nWidth * m_nHeight * 4;
|
||||||
m_pData = new unsigned char[bufferSize];
|
m_pData = new unsigned char[bufferSize];
|
||||||
|
|
||||||
config.output.u.RGBA.rgba = (uint8_t*)m_pData;
|
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.u.RGBA.size = bufferSize;
|
||||||
config.output.is_external_memory = 1;
|
config.output.is_external_memory = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue