Skip to content

Commit 29e12e5

Browse files
committed
Merge pull request #3283 from pandamicro/develop
Fix issues for v3.11 release
2 parents d176dc4 + d03af93 commit 29e12e5

File tree

7 files changed

+29
-15
lines changed

7 files changed

+29
-15
lines changed

Diff for: cocos2d/core/base-nodes/CCNode.js

+1
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,7 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
12881288
if (this._isTransitionFinished)
12891289
child.onEnterTransitionDidFinish();
12901290
}
1291+
child._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
12911292
if (this._cascadeColorEnabled)
12921293
child._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty);
12931294
if (this._cascadeOpacityEnabled)

Diff for: cocos2d/core/event-manager/CCEventManager.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,15 @@ cc.eventManager = /** @lends cc.eventManager# */{
436436

437437
if(sceneGraphPriorityListeners){
438438
idx = sceneGraphPriorityListeners.indexOf(selListener);
439-
sceneGraphPriorityListeners.splice(idx, 1);
439+
if (idx !== -1) {
440+
sceneGraphPriorityListeners.splice(idx, 1);
441+
}
440442
}
441443
if(fixedPriorityListeners){
442444
idx = fixedPriorityListeners.indexOf(selListener);
443-
fixedPriorityListeners.splice(idx, 1);
445+
if (idx !== -1) {
446+
fixedPriorityListeners.splice(idx, 1);
447+
}
444448
}
445449
}
446450
toRemovedListeners.length = 0;

Diff for: cocos2d/core/platform/CCInputExtension.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,8 @@ _p.didAccelerate = function (eventData) {
108108
z = (eventData["alpha"] / 90) * 0.981;
109109
}
110110

111-
if(cc.sys.os === cc.sys.OS_ANDROID){
112-
mAcceleration.x = -x;
113-
mAcceleration.y = -y;
114-
}else{
115-
mAcceleration.x = x;
116-
mAcceleration.y = y;
117-
}
111+
mAcceleration.x = x;
112+
mAcceleration.y = y;
118113
mAcceleration.z = z;
119114

120115
mAcceleration.timestamp = eventData.timeStamp || Date.now();

Diff for: cocos2d/core/renderer/RendererWebGL.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ function createVirtualBuffer (buffer, vertexOffset, totalBufferSize, count, data
127127
// Total vertex array buffer size, including vertex data, in bytes
128128
totalBufferSize: totalBufferSize,
129129
// Render command count
130-
count: count
130+
count: count,
131+
// Valid flag, indicate whether the buffer is valid or not
132+
valid: true
131133
};
132134
return vBuf;
133135
}
@@ -387,7 +389,7 @@ return {
387389
currBuf = cmd1._vBuffer;
388390
matched = false;
389391
// Check to update virtual buffer
390-
if (currBuf) {
392+
if (currBuf && currBuf.valid) {
391393
j = cmd1._currId;
392394
// Removed from the command list
393395
if (j < 0 || j >= currLen) {
@@ -497,7 +499,7 @@ return {
497499
_currentBuffer = null;
498500

499501
// Protection, vbuffer invalid or doesn't match the command
500-
if (cmd._vertexOffset !== vbuffer.vertexOffset || !vbuffer.buffer) {
502+
if (cmd._vertexOffset !== vbuffer.vertexOffset || !vbuffer.valid || !vbuffer.buffer) {
501503
_bufferError = true;
502504
return 0;
503505
}

Diff for: cocos2d/core/sprites/CCSpriteCanvasRenderCmd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
w = locWidth * scaleX;
150150
h = locHeight * scaleY;
151151

152-
if (texture) {
152+
if (texture && texture._htmlElementObj) {
153153
image = texture._htmlElementObj;
154154
if (texture._pattern !== "") {
155155
wrapper.setFillStyle(context.createPattern(image, texture._pattern));

Diff for: cocos2d/core/sprites/CCSpriteWebGLRenderCmd.js

+8
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@
8787
info.shader = this.batchShader;
8888
};
8989

90+
proto._invalidBatch = function () {
91+
if (this._vBuffer) {
92+
this._vBuffer.valid = false;
93+
}
94+
};
95+
9096
proto.updateBuffer = function () {
9197
if (!this._buffer) {
9298
var length = this.vertexBytesPerUnit;
@@ -390,6 +396,7 @@
390396
}
391397
node.opacityModifyRGB = true;
392398
}
399+
this._invalidBatch();
393400
};
394401

395402
proto._setTexture = function (texture) {
@@ -404,6 +411,7 @@
404411
if(node._texture !== texture){
405412
node._textureLoaded = texture ? texture._textureLoaded : false;
406413
node._texture = texture;
414+
// This will invalid current batch
407415
this._updateBlendFunc();
408416
}
409417
}

Diff for: cocos2d/core/utils/CCProfiler.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,17 @@ cc.profiler = (function () {
124124
this.init();
125125
}
126126

127-
cc.container.appendChild(_fps);
127+
if (_fps.parentElement === null) {
128+
cc.container.appendChild(_fps);
129+
}
128130
_showFPS = true;
129131
},
130132

131133
hideStats: function () {
132134
_showFPS = false;
133-
cc.container.removeChild(_fps);
135+
if (_fps.parentElement === cc.container) {
136+
cc.container.removeChild(_fps);
137+
}
134138
},
135139

136140
init: function () {

0 commit comments

Comments
 (0)