Fix a couple of newly introduced bugs through CanvasProvider change.

This commit is contained in:
Jürg Lehni 2013-02-12 16:23:30 -08:00
parent ea1e7fccb9
commit e9fef8a53c
3 changed files with 2 additions and 3 deletions

View file

@ -1109,7 +1109,6 @@ var Item = this.Item = Base.extend(Callback, {
this.draw(ctx, {});
var raster = new Raster(canvas);
raster.setBounds(bounds);
CanvasProvider.release(canvas);
// NOTE: We don't need to release the canvas since it now belongs to the
// Raster!
return raster;

View file

@ -167,7 +167,7 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{
ctx.drawImage(this._image, 0, 0);
this._canvas = ctx.canvas;
} catch (e) {
CanvasProvider.release(canvas);
CanvasProvider.release(ctx);
}
}
return this._canvas;

View file

@ -16,7 +16,7 @@ var CanvasProvider = {
canvases: [],
getCanvas: function(width, height) {
var size = height === undefined ? Size.create(width, height) : width;
var size = height === undefined ? width : Size.create(width, height);
if (this.canvases.length) {
var canvas = this.canvases.pop();
// If they are not the same size, we don't need to clear them