1.cocos/editor-support/cocostudio/CCArmature.cpp
125行
bool Armature::init(const std::string& name)
{
bool bRet = false;
do
{
removeAllChildren();
CC_SAFE_DELETE(_animation);
_animation = new ArmatureAnimation();
_animation->init(this);
_boneDic.clear();
_topBoneList.clear();
- _blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;
+ _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
_name = name;
@@ -404,13 +404,20 @@ void Armature::draw(cocos2d::Renderer *renderer, const Mat4 &transform, uint32_t
BlendFunc func = bone->getBlendFunc();
- if (func.src != _blendFunc.src || func.dst != _blendFunc.dst)
+ if (func.src != BlendFunc::ALPHA_PREMULTIPLIED.src || func.dst != BlendFunc::ALPHA_PREMULTIPLIED.dst)
{
skin->setBlendFunc(bone->getBlendFunc());
}
else
{
- skin->setBlendFunc(_blendFunc);
+ if (_blendFunc == BlendFunc::ALPHA_PREMULTIPLIED && !skin->getTexture()->hasPremultipliedAlpha())
+ {
+ skin->setBlendFunc(_blendFunc.ALPHA_NON_PREMULTIPLIED);
+ }
+ else
+ {
+ skin->setBlendFunc(_blendFunc);
+ }
}
skin->draw(renderer, transform, flags);
}
cocos/editor-support/cocostudio/CCBone.cpp
74行
// _worldTransform = AffineTransformMake(1, 0, 0, 1, 0, 0);
_worldTransform = Mat4::IDENTITY;
_boneTransformDirty = true;
- _blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;
+ _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
_blendDirty = false;
_worldInfo = nullptr;
cocos/editor-support/cocostudio/CCDataReaderHelper.cpp
1050行
{
case BLEND_NORMAL:
{
- frameData->blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;
+ frameData->blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
}
break;
case BLEND_ADD:
@@ -1614,8 +1614,8 @@ FrameData *DataReaderHelper::decodeFrame(const rapidjson::Value& json, DataInfo
frameData->tweenEasing = (TweenType)(DICTOOL->getIntValue_json(json, A_TWEEN_EASING, cocos2d::tweenfunc::Linear));
frameData->displayIndex = DICTOOL->getIntValue_json(json, A_DISPLAY_INDEX);
- frameData->blendFunc.src = (GLenum)(DICTOOL->getIntValue_json(json, A_BLEND_SRC, BlendFunc::ALPHA_NON_PREMULTIPLIED.src));
- frameData->blendFunc.dst = (GLenum)(DICTOOL->getIntValue_json(json, A_BLEND_DST, BlendFunc::ALPHA_NON_PREMULTIPLIED.dst));
+ frameData->blendFunc.src = (GLenum)(DICTOOL->getIntValue_json(json, A_BLEND_SRC, BlendFunc::ALPHA_PREMULTIPLIED.src));
+ frameData->blendFunc.dst = (GLenum)(DICTOOL->getIntValue_json(json, A_BLEND_DST, BlendFunc::ALPHA_PREMULTIPLIED.dst));
frameData->isTween = DICTOOL->getBooleanValue_json(json, A_TWEEN_FRAME, true);
const char *event = DICTOOL->getStringValue_json(json, A_EVENT);
2 cocos/editor-support/cocostudio/CCDatas.cpp
254行
, easingParams(nullptr)
, isTween(true)
, displayIndex(0)
- , blendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED)
+ , blendFunc(BlendFunc::ALPHA_PREMULTIPLIED)
, strEvent("")
, strMovement("")