From d856e7c572e71a1f8095c07ea2932b7b6602e386 Mon Sep 17 00:00:00 2001 From: Julian Viereck Date: Thu, 23 Jun 2011 22:24:41 +0200 Subject: [PATCH] Clear the main canvas right before the next rendering begins. Keeps the canvas from beeing blank for a few ms --- worker_client.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/worker_client.js b/worker_client.js index 62a7c1377..c1e124693 100644 --- a/worker_client.js +++ b/worker_client.js @@ -202,10 +202,17 @@ function WorkerPDFDoc(canvas) { // There might be fonts that need to get loaded. Shedule the // rendering at the end of the event queue ensures this. setTimeout(function() { - if (id == 0) tic(); + if (id == 0) { + tic(); + var ctx = this.ctx; + ctx.save(); + ctx.fillStyle = "rgb(255, 255, 255)"; + ctx.fillRect(0, 0, canvas.width, canvas.height); + ctx.restore(); + } renderProxyCanvas(canvasList[id], cmdQueue); if (id == 0) toc("canvas rendering") - }, 0); + }, 0, this); } } @@ -239,12 +246,6 @@ WorkerPDFDoc.prototype.open = function(url, callback) { } WorkerPDFDoc.prototype.showPage = function(numPage) { - var ctx = this.ctx; - ctx.save(); - ctx.fillStyle = "rgb(255, 255, 255)"; - ctx.fillRect(0, 0, canvas.width, canvas.height); - ctx.restore(); - this.numPage = parseInt(numPage); this.worker.postMessage(numPage); if (this.onChangePage) {