From dc51384a1a3a05bbac29c2ca169a6199d0332322 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Thu, 24 Feb 2011 01:29:51 +0100 Subject: [PATCH] Allow CanvasProvider to receive sizes too. --- src/util/CanvasProvider.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/util/CanvasProvider.js b/src/util/CanvasProvider.js index e2f139d1..abcfba10 100644 --- a/src/util/CanvasProvider.js +++ b/src/util/CanvasProvider.js @@ -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); } };