diff --git a/src/item/Item.js b/src/item/Item.js index 87b9ae6d..6b9f9b1a 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -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; diff --git a/src/item/Raster.js b/src/item/Raster.js index 8922b902..23d5c295 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.js @@ -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; diff --git a/src/util/CanvasProvider.js b/src/util/CanvasProvider.js index 3d98de18..4b9c6b03 100644 --- a/src/util/CanvasProvider.js +++ b/src/util/CanvasProvider.js @@ -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