Skip to content

Commit 63a2c37

Browse files
committed
Issue cocos2d#2416: rename sprite _changeTextureColor
1 parent 9722555 commit 63a2c37

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

cocos2d/core/sprites/CCSpriteCanvasRenderCmd.js

+7-12
Original file line numberDiff line numberDiff line change
@@ -239,18 +239,18 @@
239239
cc.g_NumberOfDraws++;
240240
};
241241

242-
proto._changeTextureColor = function () {
242+
proto._updateColor = function () {
243243
var node = this._node;
244244
var displayedColor = this._displayedColor;
245245

246246
if(this._colorized){
247-
if(displayedColor.r === 255 && displayedColor.g === 255 && displayedColor.b === 255 && displayedColor.a === 255){
247+
if(displayedColor.r === 255 && displayedColor.g === 255 && displayedColor.b === 255){
248248
this._colorized = false;
249249
node.texture = this._originalTexture;
250250
return;
251251
}
252252
}else
253-
if(displayedColor.r === 255 && displayedColor.g === 255 && displayedColor.b === 255 && displayedColor.a === 255)
253+
if(displayedColor.r === 255 && displayedColor.g === 255 && displayedColor.b === 255)
254254
return;
255255

256256
var locElement, locTexture = node._texture, locRect = this._textureCoord;
@@ -305,7 +305,7 @@
305305
if (textureLoaded) {
306306
var curColor = node.getColor();
307307
if (curColor.r !== 255 || curColor.g !== 255 || curColor.b !== 255)
308-
this._changeTextureColor();
308+
this._updateColor();
309309
}
310310
};
311311

@@ -339,12 +339,7 @@
339339

340340
proto._updateDisplayColor = function (parentColor) {
341341
cc.Node.CanvasRenderCmd.prototype._updateDisplayColor.call(this, parentColor);
342-
this._changeTextureColor();
343-
};
344-
345-
proto._syncDisplayColor = function(parentColor){
346-
cc.Node.CanvasRenderCmd.prototype._syncDisplayColor.call(this, parentColor);
347-
this._changeTextureColor();
342+
this._updateColor();
348343
};
349344

350345
proto._spriteFrameLoadedCallback = function (spriteFrame) {
@@ -354,7 +349,7 @@
354349
//TODO change
355350
var curColor = _t.getColor();
356351
if (curColor.r !== 255 || curColor.g !== 255 || curColor.b !== 255)
357-
_t._changeTextureColor();
352+
_t._updateColor();
358353

359354
_t.dispatchEvent("load");
360355
};
@@ -380,7 +375,7 @@
380375
//set the texture's color after the it loaded
381376
var locColor = locRenderCmd._displayedColor;
382377
if (locColor.r != 255 || locColor.g != 255 || locColor.b != 255)
383-
locRenderCmd._changeTextureColor();
378+
locRenderCmd._updateColor();
384379

385380
// by default use "Self Render".
386381
// if the sprite is added to a batchnode, then it will automatically switch to "batchnode Render"

0 commit comments

Comments
 (0)