|
241 | 241 |
|
242 | 242 | proto._changeTextureColor = function () {
|
243 | 243 | var node = this._node;
|
| 244 | + var displayedColor = this._displayedColor; |
| 245 | + |
| 246 | + if(this._colorized){ |
| 247 | + if(displayedColor.r === 255 && displayedColor.g === 255 && displayedColor.b === 255 && displayedColor.a === 255){ |
| 248 | + this._colorized = false; |
| 249 | + node.texture = this._originalTexture; |
| 250 | + return; |
| 251 | + } |
| 252 | + }else |
| 253 | + if(displayedColor.r === 255 && displayedColor.g === 255 && displayedColor.b === 255 && displayedColor.a === 255) |
| 254 | + return; |
| 255 | + |
244 | 256 | var locElement, locTexture = node._texture, locRect = this._textureCoord;
|
245 | 257 | if (locTexture && locRect.validRect && this._originalTexture) {
|
246 | 258 | locElement = locTexture.getHtmlElementObj();
|
|
253 | 265 | this._colorized = true;
|
254 | 266 | //generate color texture cache
|
255 | 267 | if (locElement instanceof HTMLCanvasElement && !this._rectRotated && !this._newTextureWhenChangeColor)
|
256 |
| - cc.Sprite.CanvasRenderCmd._generateTintImage(locElement, cacheTextureForColor, this._displayedColor, locRect, locElement); |
| 268 | + cc.Sprite.CanvasRenderCmd._generateTintImage(locElement, cacheTextureForColor, displayedColor, locRect, locElement); |
257 | 269 | else {
|
258 |
| - locElement = cc.Sprite.CanvasRenderCmd._generateTintImage(locElement, cacheTextureForColor, this._displayedColor, locRect); |
| 270 | + locElement = cc.Sprite.CanvasRenderCmd._generateTintImage(locElement, cacheTextureForColor, displayedColor, locRect); |
259 | 271 | locTexture = new cc.Texture2D();
|
260 | 272 | locTexture.initWithElement(locElement);
|
261 | 273 | locTexture.handleLoadedTexture();
|
|
266 | 278 | this._colorized = true;
|
267 | 279 | if (locElement instanceof HTMLCanvasElement && !this._rectRotated && !this._newTextureWhenChangeColor
|
268 | 280 | && this._originalTexture._htmlElementObj != locElement)
|
269 |
| - cc.Sprite.CanvasRenderCmd._generateTintImageWithMultiply(this._originalTexture._htmlElementObj, this._displayedColor, locRect, locElement); |
| 281 | + cc.Sprite.CanvasRenderCmd._generateTintImageWithMultiply(this._originalTexture._htmlElementObj, displayedColor, locRect, locElement); |
270 | 282 | else {
|
271 |
| - locElement = cc.Sprite.CanvasRenderCmd._generateTintImageWithMultiply(this._originalTexture._htmlElementObj, this._displayedColor, locRect); |
| 283 | + locElement = cc.Sprite.CanvasRenderCmd._generateTintImageWithMultiply(this._originalTexture._htmlElementObj, displayedColor, locRect); |
272 | 284 | locTexture = new cc.Texture2D();
|
273 | 285 | locTexture.initWithElement(locElement);
|
274 | 286 | locTexture.handleLoadedTexture();
|
|
0 commit comments