Skip to content

Fix issues for v3.11 release #3283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cocos2d/core/base-nodes/CCNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,7 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
if (this._isTransitionFinished)
child.onEnterTransitionDidFinish();
}
child._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
if (this._cascadeColorEnabled)
child._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty);
if (this._cascadeOpacityEnabled)
Expand Down
8 changes: 6 additions & 2 deletions cocos2d/core/event-manager/CCEventManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,15 @@ cc.eventManager = /** @lends cc.eventManager# */{

if(sceneGraphPriorityListeners){
idx = sceneGraphPriorityListeners.indexOf(selListener);
sceneGraphPriorityListeners.splice(idx, 1);
if (idx !== -1) {
sceneGraphPriorityListeners.splice(idx, 1);
}
}
if(fixedPriorityListeners){
idx = fixedPriorityListeners.indexOf(selListener);
fixedPriorityListeners.splice(idx, 1);
if (idx !== -1) {
fixedPriorityListeners.splice(idx, 1);
}
}
}
toRemovedListeners.length = 0;
Expand Down
9 changes: 2 additions & 7 deletions cocos2d/core/platform/CCInputExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,8 @@ _p.didAccelerate = function (eventData) {
z = (eventData["alpha"] / 90) * 0.981;
}

if(cc.sys.os === cc.sys.OS_ANDROID){
mAcceleration.x = -x;
mAcceleration.y = -y;
}else{
mAcceleration.x = x;
mAcceleration.y = y;
}
mAcceleration.x = x;
mAcceleration.y = y;
mAcceleration.z = z;

mAcceleration.timestamp = eventData.timeStamp || Date.now();
Expand Down
8 changes: 5 additions & 3 deletions cocos2d/core/renderer/RendererWebGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ function createVirtualBuffer (buffer, vertexOffset, totalBufferSize, count, data
// Total vertex array buffer size, including vertex data, in bytes
totalBufferSize: totalBufferSize,
// Render command count
count: count
count: count,
// Valid flag, indicate whether the buffer is valid or not
valid: true
};
return vBuf;
}
Expand Down Expand Up @@ -387,7 +389,7 @@ return {
currBuf = cmd1._vBuffer;
matched = false;
// Check to update virtual buffer
if (currBuf) {
if (currBuf && currBuf.valid) {
j = cmd1._currId;
// Removed from the command list
if (j < 0 || j >= currLen) {
Expand Down Expand Up @@ -497,7 +499,7 @@ return {
_currentBuffer = null;

// Protection, vbuffer invalid or doesn't match the command
if (cmd._vertexOffset !== vbuffer.vertexOffset || !vbuffer.buffer) {
if (cmd._vertexOffset !== vbuffer.vertexOffset || !vbuffer.valid || !vbuffer.buffer) {
_bufferError = true;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion cocos2d/core/sprites/CCSpriteCanvasRenderCmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
w = locWidth * scaleX;
h = locHeight * scaleY;

if (texture) {
if (texture && texture._htmlElementObj) {
image = texture._htmlElementObj;
if (texture._pattern !== "") {
wrapper.setFillStyle(context.createPattern(image, texture._pattern));
Expand Down
8 changes: 8 additions & 0 deletions cocos2d/core/sprites/CCSpriteWebGLRenderCmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@
info.shader = this.batchShader;
};

proto._invalidBatch = function () {
if (this._vBuffer) {
this._vBuffer.valid = false;
}
};

proto.updateBuffer = function () {
if (!this._buffer) {
var length = this.vertexBytesPerUnit;
Expand Down Expand Up @@ -390,6 +396,7 @@
}
node.opacityModifyRGB = true;
}
this._invalidBatch();
};

proto._setTexture = function (texture) {
Expand All @@ -404,6 +411,7 @@
if(node._texture !== texture){
node._textureLoaded = texture ? texture._textureLoaded : false;
node._texture = texture;
// This will invalid current batch
this._updateBlendFunc();
}
}
Expand Down
8 changes: 6 additions & 2 deletions cocos2d/core/utils/CCProfiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,17 @@ cc.profiler = (function () {
this.init();
}

cc.container.appendChild(_fps);
if (_fps.parentElement === null) {
cc.container.appendChild(_fps);
}
_showFPS = true;
},

hideStats: function () {
_showFPS = false;
cc.container.removeChild(_fps);
if (_fps.parentElement === cc.container) {
cc.container.removeChild(_fps);
}
},

init: function () {
Expand Down