mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Fix a recently introduce but in Raster#getCanvas().
This commit is contained in:
parent
357b7dbc54
commit
9600fdb512
2 changed files with 8 additions and 4 deletions
|
@ -1105,10 +1105,13 @@ var Item = this.Item = Base.extend(Callback, {
|
|||
ctx = canvas.getContext('2d'),
|
||||
matrix = new Matrix().scale(scale).translate(-bounds.x, -bounds.y);
|
||||
matrix.applyToContext(ctx);
|
||||
// XXX: Decide how to handle _matrix
|
||||
// TODO: Decide how to handle _matrix
|
||||
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;
|
||||
},
|
||||
|
||||
|
|
|
@ -163,11 +163,12 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{
|
|||
// policies, wrap the call in try-catch and only set _canvas if we
|
||||
// succeeded.
|
||||
try {
|
||||
if (this._image)
|
||||
this.getContext(true).drawImage(this._image, 0, 0);
|
||||
this._canvas = canvas;
|
||||
if (this._image)
|
||||
this.getContext().drawImage(this._image, 0, 0);
|
||||
} catch (e) {
|
||||
CanvasProvider.returnCanvas(canvas);
|
||||
this._canvas = null;
|
||||
CanvasProvider.release(canvas);
|
||||
}
|
||||
}
|
||||
return this._canvas;
|
||||
|
|
Loading…
Reference in a new issue