From 5d680b198768073a7c22800cbbbdd459604210bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 2 Mar 2011 16:07:44 +0000 Subject: [PATCH] Reformat code and add comment about clearRect dimensions. --- src/util/CanvasProvider.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/CanvasProvider.js b/src/util/CanvasProvider.js index 37e0e655..2c0730b6 100644 --- a/src/util/CanvasProvider.js +++ b/src/util/CanvasProvider.js @@ -10,11 +10,13 @@ CanvasProvider = { var canvas = this.canvases.pop(); // If they are not the same size, we don't need to clear them // using clearRect and visa versa. - if ((canvas.width != size.width) || (canvas.height != size.height)) { + if ((canvas.width != size.width) + || (canvas.height != size.height)) { canvas.width = size.width; canvas.height = size.height; } else { var context = canvas.getContext('2d'); + // +1 is needed on some browsers to really clear the borders context.clearRect(0, 0, size.width + 1, size.height + 1); } return canvas;