Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why enable
premultipliedAlphaeven png format isn't RGBA8888, any errors? maybe you useCCImagein wrong way.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drelaptop
oh, yes, if png format is not RGBA8888, premultipliedAlpha should not be true.
But, there is a case, I want to use PMA pngs to improve performance and prevent blend artifacts, so I use
Image::setPNGPremultipliedAlphaEnabled(false), but it doesn't work, becauseCCImage.hasPremultipliedAlpha()will return false atTexture2D::initWithImageif you don't set premultipliedAlpha to true when png format is RGBA8888.I will resubmit a PR, the code is like the followings:

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drelaptop The new PR is #19138, you can check it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, you hope
CCImage.hasPremultipliedAlpha()returntrue, but you didsetPNGPremultipliedAlphaEnabled(false)before. that is confusing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drelaptop
setPNGPremultipliedAlphaEnabled(false)changesPNG_PREMULTIPLIED_ALPHA_ENABLEDto false, it tells cocos2dx that pngs have been PMAed by developers, so cocos2dx needn't to dopremultipliedAlpha,premultipliedAlphatakes about 40ms for 2048*2048 pngs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drelaptop I read

CCImage.cpp, andsetPNGPremultipliedAlphaEnabled(false)maybe the only way to use PMAed pngs.Doesn't cocos2dx support PMAed pngs?