mirror of https://github.com/axmolengine/axmol.git
Merge pull request #16218 from cezheng/fix/etc_premultiplied_alpha_value
fix CCImage premultipliedAlpha for ETC format
This commit is contained in:
commit
e6b42d486b
|
@ -466,7 +466,7 @@ Image::Image()
|
||||||
, _fileType(Format::UNKNOWN)
|
, _fileType(Format::UNKNOWN)
|
||||||
, _renderFormat(Texture2D::PixelFormat::NONE)
|
, _renderFormat(Texture2D::PixelFormat::NONE)
|
||||||
, _numberOfMipmaps(0)
|
, _numberOfMipmaps(0)
|
||||||
, _hasPremultipliedAlpha(true)
|
, _hasPremultipliedAlpha(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -813,7 +813,6 @@ bool Image::decodeWithWIC(const unsigned char *data, ssize_t dataLen)
|
||||||
{
|
{
|
||||||
_width = img.getWidth();
|
_width = img.getWidth();
|
||||||
_height = img.getHeight();
|
_height = img.getHeight();
|
||||||
_hasPremultipliedAlpha = false;
|
|
||||||
|
|
||||||
WICPixelFormatGUID format = img.getPixelFormat();
|
WICPixelFormatGUID format = img.getPixelFormat();
|
||||||
|
|
||||||
|
@ -963,7 +962,6 @@ bool Image::initWithJpgData(const unsigned char * data, ssize_t dataLen)
|
||||||
/* init image info */
|
/* init image info */
|
||||||
_width = cinfo.output_width;
|
_width = cinfo.output_width;
|
||||||
_height = cinfo.output_height;
|
_height = cinfo.output_height;
|
||||||
_hasPremultipliedAlpha = false;
|
|
||||||
|
|
||||||
_dataLen = cinfo.output_width*cinfo.output_height*cinfo.output_components;
|
_dataLen = cinfo.output_width*cinfo.output_height*cinfo.output_components;
|
||||||
_data = static_cast<unsigned char*>(malloc(_dataLen * sizeof(unsigned char)));
|
_data = static_cast<unsigned char*>(malloc(_dataLen * sizeof(unsigned char)));
|
||||||
|
@ -1129,10 +1127,6 @@ bool Image::initWithPngData(const unsigned char * data, ssize_t dataLen)
|
||||||
{
|
{
|
||||||
premultipliedAlpha();
|
premultipliedAlpha();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
_hasPremultipliedAlpha = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (row_pointers != nullptr)
|
if (row_pointers != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -1583,8 +1577,6 @@ bool Image::initWithPVRv3Data(const unsigned char * data, ssize_t dataLen)
|
||||||
{
|
{
|
||||||
_hasPremultipliedAlpha = true;
|
_hasPremultipliedAlpha = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
_hasPremultipliedAlpha = false;
|
|
||||||
|
|
||||||
// sizing
|
// sizing
|
||||||
int width = CC_SWAP_INT32_LITTLE_TO_HOST(header->width);
|
int width = CC_SWAP_INT32_LITTLE_TO_HOST(header->width);
|
||||||
|
@ -1811,8 +1803,6 @@ bool Image::initWithTGAData(tImageTGA* tgaData)
|
||||||
_dataLen = _width * _height * tgaData->pixelDepth / 8;
|
_dataLen = _width * _height * tgaData->pixelDepth / 8;
|
||||||
_fileType = Format::TGA;
|
_fileType = Format::TGA;
|
||||||
|
|
||||||
_hasPremultipliedAlpha = false;
|
|
||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
}while(false);
|
}while(false);
|
||||||
|
@ -1847,7 +1837,6 @@ namespace
|
||||||
|
|
||||||
bool Image::initWithS3TCData(const unsigned char * data, ssize_t dataLen)
|
bool Image::initWithS3TCData(const unsigned char * data, ssize_t dataLen)
|
||||||
{
|
{
|
||||||
_hasPremultipliedAlpha = false;
|
|
||||||
const uint32_t FOURCC_DXT1 = makeFourCC('D', 'X', 'T', '1');
|
const uint32_t FOURCC_DXT1 = makeFourCC('D', 'X', 'T', '1');
|
||||||
const uint32_t FOURCC_DXT3 = makeFourCC('D', 'X', 'T', '3');
|
const uint32_t FOURCC_DXT3 = makeFourCC('D', 'X', 'T', '3');
|
||||||
const uint32_t FOURCC_DXT5 = makeFourCC('D', 'X', 'T', '5');
|
const uint32_t FOURCC_DXT5 = makeFourCC('D', 'X', 'T', '5');
|
||||||
|
|
Loading…
Reference in New Issue