Fix texture scaling in canvas renderer
This commit is contained in:
parent
cef2ceb286
commit
a31137a2aa
2 changed files with 19 additions and 22 deletions
|
@ -323,11 +323,10 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession)
|
||||||
context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2], transform[5]);
|
context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2], transform[5]);
|
||||||
|
|
||||||
//if smoothingEnabled is supported and we need to change the smoothing property for this texture
|
//if smoothingEnabled is supported and we need to change the smoothing property for this texture
|
||||||
// if(this.smoothProperty && this.scaleMode !== displayObject.texture.baseTexture.scaleMode) {
|
if(renderSession.smoothProperty && renderSession.scaleMode !== displayObject.texture.baseTexture.scaleMode) {
|
||||||
// this.scaleMode = displayObject.texture.baseTexture.scaleMode;
|
renderSession.scaleMode = this.texture.baseTexture.scaleMode;
|
||||||
// context[this.smoothProperty] = (this.scaleMode === PIXI.BaseTexture.SCALE_MODE.LINEAR);
|
context[renderSession.smoothProperty] = (renderSession.scaleMode === PIXI.BaseTexture.SCALE_MODE.LINEAR);
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(this.tint !== 0xFFFFFF)
|
if(this.tint !== 0xFFFFFF)
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,19 +100,6 @@ PIXI.CanvasRenderer = function(width, height, view, transparent)
|
||||||
* @type Canvas 2d Context
|
* @type Canvas 2d Context
|
||||||
*/
|
*/
|
||||||
this.context = this.view.getContext( "2d", { alpha: this.transparent } );
|
this.context = this.view.getContext( "2d", { alpha: this.transparent } );
|
||||||
//some filter variables
|
|
||||||
this.smoothProperty = null;
|
|
||||||
|
|
||||||
if("imageSmoothingEnabled" in this.context)
|
|
||||||
this.smoothProperty = "imageSmoothingEnabled";
|
|
||||||
else if("webkitImageSmoothingEnabled" in this.context)
|
|
||||||
this.smoothProperty = "webkitImageSmoothingEnabled";
|
|
||||||
else if("mozImageSmoothingEnabled" in this.context)
|
|
||||||
this.smoothProperty = "mozImageSmoothingEnabled";
|
|
||||||
else if("oImageSmoothingEnabled" in this.context)
|
|
||||||
this.smoothProperty = "oImageSmoothingEnabled";
|
|
||||||
|
|
||||||
this.scaleMode = null;
|
|
||||||
|
|
||||||
this.refresh = true;
|
this.refresh = true;
|
||||||
// hack to enable some hardware acceleration!
|
// hack to enable some hardware acceleration!
|
||||||
|
@ -124,10 +111,21 @@ PIXI.CanvasRenderer = function(width, height, view, transparent)
|
||||||
|
|
||||||
this.maskManager = new PIXI.CanvasMaskManager();
|
this.maskManager = new PIXI.CanvasMaskManager();
|
||||||
|
|
||||||
this.renderSession = {};
|
this.renderSession = {
|
||||||
this.renderSession.context = this.context;
|
context: this.context,
|
||||||
this.renderSession.maskManager = this.maskManager;
|
maskManager: this.maskManager,
|
||||||
|
scaleMode: null,
|
||||||
|
smoothProperty: null
|
||||||
|
};
|
||||||
|
|
||||||
|
if("imageSmoothingEnabled" in this.context)
|
||||||
|
this.renderSession.smoothProperty = "imageSmoothingEnabled";
|
||||||
|
else if("webkitImageSmoothingEnabled" in this.context)
|
||||||
|
this.renderSession.smoothProperty = "webkitImageSmoothingEnabled";
|
||||||
|
else if("mozImageSmoothingEnabled" in this.context)
|
||||||
|
this.renderSession.smoothProperty = "mozImageSmoothingEnabled";
|
||||||
|
else if("oImageSmoothingEnabled" in this.context)
|
||||||
|
this.renderSession.smoothProperty = "oImageSmoothingEnabled";
|
||||||
};
|
};
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue