Skip to content

Commit a2114e0

Browse files
committed
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-html5 into Iss2698_namespace
2 parents 843c0ee + 2764163 commit a2114e0

File tree

3 files changed

+17
-25
lines changed

3 files changed

+17
-25
lines changed

cocos2d/tilemap/CCTMXLayer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ cc.TMXLayer = cc.SpriteBatchNode.extend(/** @lends cc.TMXLayer# */{
370370
* @return {Number}
371371
*/
372372
getTileGIDAt:function (pos, y) {
373-
if(!pos)
373+
if(pos == null)
374374
throw "cc.TMXLayer.getTileGIDAt(): pos should be non-null";
375375
if(y !== undefined)
376376
pos = cc.p(pos, y);

cocos2d/tilemap/CCTMXLayerCanvasRenderCmd.js

+11-19
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
cc.SpriteBatchNode.CanvasRenderCmd.call(this, renderable);
2828
this._needDraw = true;
2929
this._realWorldTransform = {a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0};
30-
this._childrenRenderCmds = [];
3130

3231
var locCanvas = cc._canvas;
3332
var tmpCanvas = cc.newElement('canvas');
@@ -46,36 +45,32 @@
4645
var proto = cc.TMXLayer.CanvasRenderCmd.prototype = Object.create(cc.SpriteBatchNode.CanvasRenderCmd.prototype);
4746
proto.constructor = cc.TMXLayer.CanvasRenderCmd;
4847

49-
proto._copyRendererCmds = function (rendererCmds) {
50-
if (!rendererCmds)
51-
return;
52-
53-
var locCacheCmds = this._childrenRenderCmds;
54-
locCacheCmds.length = 0;
55-
for (var i = 0, len = rendererCmds.length; i < len; i++) {
56-
locCacheCmds[i] = rendererCmds[i];
57-
}
58-
};
59-
6048
//set the cache dirty flag for canvas
6149
proto._setNodeDirtyForCache = function () {
6250
this._cacheDirty = true;
6351
};
6452

6553
proto._renderingChildToCache = function (scaleX, scaleY) {
6654
if (this._cacheDirty) {
67-
var locCacheCmds = this._childrenRenderCmds, wrapper = this._cacheContext,
55+
var wrapper = this._cacheContext,
6856
context = wrapper.getContext(), locCanvas = this._cacheCanvas;
6957

7058
//wrapper.save();
7159
context.setTransform(1, 0, 0, 1, 0, 0);
7260
context.clearRect(0, 0, locCanvas.width, locCanvas.height);
7361
//reset the cache context
7462

75-
for (var i = 0, len = locCacheCmds.length; i < len; i++) {
76-
locCacheCmds[i].rendering(wrapper, scaleX, scaleY);
77-
locCacheCmds[i]._cacheDirty = false;
63+
var locChildren = this._node._children;
64+
for (var i = 0, len = locChildren.length; i < len; i++) {
65+
if (locChildren[i]){
66+
var selCmd = locChildren[i]._renderCmd;
67+
if(selCmd){
68+
selCmd.rendering(wrapper, scaleX, scaleY);
69+
selCmd._cacheDirty = false;
70+
}
71+
}
7872
}
73+
7974
//wrapper.restore();
8075
this._cacheDirty = false;
8176
}
@@ -161,9 +156,6 @@
161156
}
162157
}
163158

164-
//copy cached render cmd array to TMXLayer renderer
165-
this._copyRendererCmds(renderer._cacheToCanvasCmds[instanceID]);
166-
167159
//wrapper.save();
168160
context.setTransform(1, 0, 0, 1, 0, 0);
169161
context.clearRect(0, 0, locCanvas.width, locCanvas.height);

extensions/ccui/uiwidgets/UICheckBox.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ ccui.CheckBox = ccui.Widget.extend(/** @lends ccui.CheckBox# */{
163163
* @param {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
164164
*/
165165
loadTextureBackGround: function (backGround, texType) {
166-
if (!backGround || (this._backGroundFileName == backGround && this._backGroundTexType == texType))
166+
if (!backGround)
167167
return;
168168

169169
texType = texType || ccui.Widget.LOCAL_TEXTURE;
@@ -206,7 +206,7 @@ ccui.CheckBox = ccui.Widget.extend(/** @lends ccui.CheckBox# */{
206206
* @param {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
207207
*/
208208
loadTextureBackGroundSelected: function (backGroundSelected, texType) {
209-
if (!backGroundSelected || (this._backGroundSelectedFileName == backGroundSelected && this._backGroundSelectedTexType == texType))
209+
if (!backGroundSelected)
210210
return;
211211

212212
texType = texType || ccui.Widget.LOCAL_TEXTURE;
@@ -246,7 +246,7 @@ ccui.CheckBox = ccui.Widget.extend(/** @lends ccui.CheckBox# */{
246246
* @param {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
247247
*/
248248
loadTextureFrontCross: function (cross, texType) {
249-
if (!cross || (this._frontCrossFileName == cross && this._frontCrossTexType == texType))
249+
if (!cross)
250250
return;
251251
texType = texType || ccui.Widget.LOCAL_TEXTURE;
252252
this._frontCrossFileName = cross;
@@ -285,7 +285,7 @@ ccui.CheckBox = ccui.Widget.extend(/** @lends ccui.CheckBox# */{
285285
* @param {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
286286
*/
287287
loadTextureBackGroundDisabled: function (backGroundDisabled, texType) {
288-
if (!backGroundDisabled || (this._backGroundDisabledFileName == backGroundDisabled && this._backGroundDisabledTexType == texType))
288+
if (!backGroundDisabled)
289289
return;
290290
texType = texType || ccui.Widget.LOCAL_TEXTURE;
291291
this._backGroundDisabledFileName = backGroundDisabled;
@@ -324,7 +324,7 @@ ccui.CheckBox = ccui.Widget.extend(/** @lends ccui.CheckBox# */{
324324
* @param {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
325325
*/
326326
loadTextureFrontCrossDisabled: function (frontCrossDisabled, texType) {
327-
if (!frontCrossDisabled || (this._frontCrossDisabledFileName == frontCrossDisabled && this._frontCrossDisabledTexType == texType))
327+
if (!frontCrossDisabled)
328328
return;
329329
texType = texType || ccui.Widget.LOCAL_TEXTURE;
330330
this._frontCrossDisabledFileName = frontCrossDisabled;

0 commit comments

Comments
 (0)