Fixed bug where tinting not working if image not loaded in canvas

also fixed issue where tiling sprite was not getting matrix transform
applied
This commit is contained in:
Mat Groves 2014-01-02 12:35:40 +00:00
parent 7713731ab3
commit 17725973bc
4 changed files with 31 additions and 9 deletions

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/
*
* Compiled: 2014-01-01
* Compiled: 2014-01-02
*
* Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php
@ -1820,11 +1820,14 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession)
{
if(this.cachedTint !== this.tint)
{
// no point tinting an image that has not loaded yet!
if(!texture.baseTexture.hasLoaded)return;
this.cachedTint = this.tint;
//TODO clean up cacheing - how to clean up the caches?
this.tintedTexture = PIXI.CanvasTinter.getTintedTexture(this, this.tint);
}
context.drawImage(this.tintedTexture,
@ -8013,6 +8016,14 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
context.globalAlpha = this.worldAlpha;
var transform = this.worldTransform;
// alow for trimming
context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2], transform[5]);
if(!this.__tilePattern)
this.__tilePattern = context.createPattern(this.texture.baseTexture.source, 'repeat');

File diff suppressed because one or more lines are too long

View file

@ -351,11 +351,14 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession)
{
if(this.cachedTint !== this.tint)
{
// no point tinting an image that has not loaded yet!
if(!texture.baseTexture.hasLoaded)return;
this.cachedTint = this.tint;
//TODO clean up cacheing - how to clean up the caches?
this.tintedTexture = PIXI.CanvasTinter.getTintedTexture(this, this.tint);
}
context.drawImage(this.tintedTexture,

View file

@ -146,6 +146,14 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
context.globalAlpha = this.worldAlpha;
var transform = this.worldTransform;
// alow for trimming
context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2], transform[5]);
if(!this.__tilePattern)
this.__tilePattern = context.createPattern(this.texture.baseTexture.source, 'repeat');