Skip to content

Commit

Permalink
modify imageSmoothingEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
himuil committed Jun 12, 2015
1 parent 40fd2df commit 9781580
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/egret/context/renderer/HTML5CanvasRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,27 @@ module egret {
this.drawCanvasContext = this.canvasContext;
}

var context = this.drawCanvasContext;
if (context["imageSmoothingEnabled"] == undefined) {
var keys:Array<string> = ["webkitImageSmoothingEnabled", "mozImageSmoothingEnabled", "msImageSmoothingEnabled"];
for (var i:number = 0; i < keys.length; i++) {
var key = keys[i];
if (context[key] != undefined) {
break;
}
}
Object.defineProperty(context, "imageSmoothingEnabled", {
get: function () {
return this[key];
},
set: function (value) {
this[key] = value;
},
enumerable: true,
configurable: true
});
}

this.onResize();

var f = this.drawCanvasContext.setTransform;
Expand Down Expand Up @@ -134,11 +155,7 @@ module egret {
this._cacheCanvas.width = this.canvas.width;
this._cacheCanvas.height = this.canvas.height;
}

this.drawCanvasContext["imageSmoothingEnabled"] = RendererContext.imageSmoothingEnabled;
this.drawCanvasContext["webkitImageSmoothingEnabled"] = RendererContext.imageSmoothingEnabled;
this.drawCanvasContext["mozImageSmoothingEnabled"] = RendererContext.imageSmoothingEnabled;
this.drawCanvasContext["msImageSmoothingEnabled"] = RendererContext.imageSmoothingEnabled;
this.drawCanvasContext["imageSmoothingEnabled"] = egret.RendererContext.imageSmoothingEnabled;
}
}

Expand Down

0 comments on commit 9781580

Please sign in to comment.