mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Fix a couple of newly introduced bugs through CanvasProvider change.
This commit is contained in:
parent
ea1e7fccb9
commit
e9fef8a53c
3 changed files with 2 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue