mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -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, {});
|
this.draw(ctx, {});
|
||||||
var raster = new Raster(canvas);
|
var raster = new Raster(canvas);
|
||||||
raster.setBounds(bounds);
|
raster.setBounds(bounds);
|
||||||
CanvasProvider.release(canvas);
|
|
||||||
// NOTE: We don't need to release the canvas since it now belongs to the
|
// NOTE: We don't need to release the canvas since it now belongs to the
|
||||||
// Raster!
|
// Raster!
|
||||||
return raster;
|
return raster;
|
||||||
|
|
|
@ -167,7 +167,7 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{
|
||||||
ctx.drawImage(this._image, 0, 0);
|
ctx.drawImage(this._image, 0, 0);
|
||||||
this._canvas = ctx.canvas;
|
this._canvas = ctx.canvas;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
CanvasProvider.release(canvas);
|
CanvasProvider.release(ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this._canvas;
|
return this._canvas;
|
||||||
|
|
|
@ -16,7 +16,7 @@ var CanvasProvider = {
|
||||||
canvases: [],
|
canvases: [],
|
||||||
|
|
||||||
getCanvas: function(width, height) {
|
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) {
|
if (this.canvases.length) {
|
||||||
var canvas = this.canvases.pop();
|
var canvas = this.canvases.pop();
|
||||||
// If they are not the same size, we don't need to clear them
|
// If they are not the same size, we don't need to clear them
|
||||||
|
|
Loading…
Reference in a new issue