mirror of https://github.com/axmolengine/axmol.git
Also decode bmp to RGBA8888 directly
This commit is contained in:
parent
f3c17427aa
commit
6c129165f5
|
@ -1210,14 +1210,15 @@ bool Image::initWithPngData(unsigned char * data, ssize_t dataLen)
|
||||||
|
|
||||||
bool Image::initWithBmpData(unsigned char* data, ssize_t dataLen)
|
bool Image::initWithBmpData(unsigned char* data, ssize_t dataLen)
|
||||||
{
|
{
|
||||||
const int nrChannels = 3;
|
const int nrChannels = 4;
|
||||||
_data = stbi_load_from_memory(data, dataLen, &_width, &_height, nullptr, nrChannels);
|
_data = stbi_load_from_memory(data, dataLen, &_width, &_height, nullptr, nrChannels);
|
||||||
if (_data) {
|
if (_data) {
|
||||||
_dataLen = _width * _height * nrChannels;
|
_dataLen = _width * _height * nrChannels;
|
||||||
_fileType = Format::BMP;
|
_fileType = Format::BMP;
|
||||||
_pixelFormat = backend::PixelFormat::RGB888;
|
_pixelFormat = backend::PixelFormat::RGBA8888;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Image::initWithWebpData(unsigned char* data, ssize_t dataLen)
|
bool Image::initWithWebpData(unsigned char* data, ssize_t dataLen)
|
||||||
|
|
Loading…
Reference in New Issue