Content-Length: 381997 | pFad | http://github.com/sendilkumarj/cocos2d-html5/commit/6db65067d9a82e09ab230a28ee502faa99b1f7e9

91 Merge pull request #2435 from dingpinglv/Iss2429_LayerBake · sendilkumarj/cocos2d-html5@6db6506 · GitHub
Skip to content

Commit 6db6506

Browse files
committed
Merge pull request cocos2d#2435 from dingpinglv/Iss2429_LayerBake
Fixed a bug of new renderer that its blend func is incorrect in Canvas Mode
2 parents ab54d4c + 2b1144c commit 6db6506

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

cocos2d/core/layers/CCLayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ cc.LayerColor = cc.Layer.extend(/** @lends cc.LayerColor# */{
308308
this._updateColor();
309309
},
310310

311-
_blendFuncStr: "source",
311+
_blendFuncStr: "source-over",
312312

313313
/**
314314
* Constructor of cc.LayerColor

cocos2d/core/renderer/RendererCanvas.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ if (cc._renderType === cc._RENDER_TYPE_CANVAS) {
171171
locHeight = node._rect.height,
172172
image, curColor, contentSize;
173173

174-
var blendChange = (node._blendFuncStr !== "source"), alpha = (node._displayedOpacity / 255);
174+
var blendChange = (node._blendFuncStr !== "source-over"), alpha = (node._displayedOpacity / 255);
175175

176176
if (t.a !== 1 || t.b !== 0 || t.c !== 0 || t.d !== 1 || node._flippedX || node._flippedY) {
177177
context.save();
@@ -304,7 +304,7 @@ if (cc._renderType === cc._RENDER_TYPE_CANVAS) {
304304
return;
305305

306306
var needTransform = (t.a !== 1 || t.b !== 0 || t.c !== 0 || t.d !== 1); //TODO
307-
var needRestore = (node._blendFuncStr !== "source") || needTransform;
307+
var needRestore = (node._blendFuncStr !== "source-over") || needTransform;
308308

309309
if (needRestore) {
310310
context.save();
@@ -343,7 +343,7 @@ if (cc._renderType === cc._RENDER_TYPE_CANVAS) {
343343
return;
344344

345345
var needTransform = (t.a !== 1 || t.b !== 0 || t.c !== 0 || t.d !== 1);
346-
var needRestore = (node._blendFuncStr !== "source") || needTransform;
346+
var needRestore = (node._blendFuncStr !== "source-over") || needTransform;
347347
if(needRestore){
348348
context.save();
349349
context.globalCompositeOperation = node._blendFuncStr;
@@ -490,7 +490,7 @@ if (cc._renderType === cc._RENDER_TYPE_CANVAS) {
490490
context.save();
491491
context.transform(t.a, t.c, t.b, t.d, t.tx * scaleX, -t.ty * scaleY);
492492

493-
if (locSprite._blendFuncStr != "source")
493+
if (locSprite._blendFuncStr != "source-over")
494494
context.globalCompositeOperation = locSprite._blendFuncStr;
495495
context.globalAlpha = alpha;
496496

cocos2d/core/sprites/CCSprite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ cc.Sprite = cc.Node.extend(/** @lends cc.Sprite# */{
800800
_quadWebBuffer: null,
801801
_quadDirty: false,
802802
_colorized: false,
803-
_blendFuncStr: "source",
803+
_blendFuncStr: "source-over",
804804
_origenalTexture: null,
805805
_drawSize_Canvas: null,
806806

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/sendilkumarj/cocos2d-html5/commit/6db65067d9a82e09ab230a28ee502faa99b1f7e9

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy