From b6ec4c9c5dcdf9154bfe1f9f7ec04632919ffce2 Mon Sep 17 00:00:00 2001 From: yangxiao Date: Mon, 14 Dec 2015 16:51:53 +0800 Subject: [PATCH] fix fast tilemap blend function --- cocos/2d/CCFastTMXLayer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCFastTMXLayer.cpp b/cocos/2d/CCFastTMXLayer.cpp index dd30153c75..34e4f046cc 100644 --- a/cocos/2d/CCFastTMXLayer.cpp +++ b/cocos/2d/CCFastTMXLayer.cpp @@ -177,7 +177,8 @@ void TMXLayer::draw(Renderer *renderer, const Mat4& transform, uint32_t flags) if(iter.second->getCount() > 0) { auto& cmd = _renderCommands[index++]; - cmd.init(iter.first, _texture->getName(), getGLProgramState(), BlendFunc::ALPHA_NON_PREMULTIPLIED, iter.second, _modelViewTransform, flags); + auto blendfunc = _texture->hasPremultipliedAlpha() ? BlendFunc::ALPHA_PREMULTIPLIED : BlendFunc::ALPHA_NON_PREMULTIPLIED; + cmd.init(iter.first, _texture->getName(), getGLProgramState(), blendfunc, iter.second, _modelViewTransform, flags); renderer->addCommand(&cmd); } }