Allow CanvasProvider to receive sizes too.

This commit is contained in:
Jonathan Puckey 2011-02-24 01:29:51 +01:00
parent f1cd24eef8
commit dc51384a1a

View file

@ -1,15 +1,18 @@
CanvasProvider = {
canvases: [],
getCanvas: function(width, height) {
getCanvas: function() {
var size = Size.read(arguments);
var canvas = this.canvases.length
? this.canvases.pop()
: document.createElement('canvas');
canvas.width = width;
canvas.height = height;
canvas.width = size.width;
canvas.height = size.height;
return canvas;
},
returnCanvas: function(canvas) {
// reset canvas:
canvas.width = canvas.width;
this.canvases.push(canvas);
}
};