]> git.parisson.com Git - pdf.js.git/commitdiff
Clear the main canvas right before the next rendering begins. Keeps the canvas from...
authorJulian Viereck <julian.viereck@gmail.com>
Thu, 23 Jun 2011 20:24:41 +0000 (22:24 +0200)
committerJulian Viereck <julian.viereck@gmail.com>
Thu, 23 Jun 2011 21:33:25 +0000 (23:33 +0200)
worker_client.js

index 62a7c1377a5c748f9aaf7943c3a1d516b7a3f5bd..c1e124693e8b39bf0ce4135baaa1af16bd683149 100644 (file)
@@ -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) {