ReFix bug: PremultipliedAlpha is not working for png (#19597)

This commit is contained in:
minggo 2019-04-10 18:33:26 -07:00 committed by GitHub
parent ffcf627c13
commit c3a0205652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -1044,9 +1044,18 @@ bool Image::initWithPngData(const unsigned char * data, ssize_t dataLen)
png_read_end(png_ptr, nullptr);
// premultiplied alpha for RGBA8888
if (PNG_PREMULTIPLIED_ALPHA_ENABLED && color_type == PNG_COLOR_TYPE_RGB_ALPHA)
if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{
premultipliedAlpha();
if (PNG_PREMULTIPLIED_ALPHA_ENABLED)
{
premultipliedAlpha();
}
else
{
#if CC_ENABLE_PREMULTIPLIED_ALPHA != 0
_hasPremultipliedAlpha = true;
#endif
}
}
if (row_pointers != nullptr)