Skip to content

Commit 3ce8142

Browse files
committed
Merge pull request cocos2d#2427 from dingpinglv/Iss1078_Particle
Fixed cocos2d#1078: Fixed the problem with particle texture in canvas mode.
2 parents 9aed43a + 15c5584 commit 3ce8142

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cocos2d/core/renderer/RendererCanvas.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ if (cc._renderType === cc._RENDER_TYPE_CANVAS) {
387387

388388
var i, particle, lpx, alpha;
389389
var particleCount = this._node.particleCount, particles = this._node._particles;
390-
if (cc.ParticleSystem.SHAPE_MODE == cc.ParticleSystem.TEXTURE_MODE) {
390+
if (node.drawMode == cc.ParticleSystem.TEXTURE_MODE) {
391391
// Delay drawing until the texture is fully loaded by the browser
392392
if (!node._texture || !node._texture._isLoaded) {
393393
context.restore();
@@ -448,7 +448,7 @@ if (cc._renderType === cc._RENDER_TYPE_CANVAS) {
448448

449449
context.save();
450450
context.translate(0 | particle.drawPos.x, -(0 | particle.drawPos.y));
451-
if (cc.ParticleSystem.BALL_SHAPE == cc.ParticleSystem.STAR_SHAPE) {
451+
if (node.shapeType == cc.ParticleSystem.STAR_SHAPE) {
452452
if (particle.rotation)
453453
context.rotate(cc.degreesToRadians(particle.rotation));
454454
drawTool.drawStar(context, lpx, particle.color);

cocos2d/core/sprites/CCSprite.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ cc.cutRotateImageToCanvas = function (texture, rect) {
228228

229229
cc._getCompositeOperationByBlendFunc = function(blendFunc){
230230
if(!blendFunc)
231-
return "source";
231+
return "source-over";
232232
else{
233233
if(( blendFunc.src == cc.SRC_ALPHA && blendFunc.dst == cc.ONE) || (blendFunc.src == cc.ONE && blendFunc.dst == cc.ONE))
234234
return "lighter";
@@ -237,7 +237,7 @@ cc._getCompositeOperationByBlendFunc = function(blendFunc){
237237
else if(blendFunc.src == cc.ZERO && blendFunc.dst == cc.ONE_MINUS_SRC_ALPHA)
238238
return "destination-out";
239239
else
240-
return "source";
240+
return "source-over";
241241
}
242242
};
243243

0 commit comments

Comments
 (0)