diff --git a/cocos/platform/CCImage.cpp b/cocos/platform/CCImage.cpp index 46a5aa3347..5dba76e014 100644 --- a/cocos/platform/CCImage.cpp +++ b/cocos/platform/CCImage.cpp @@ -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)