]> git.parisson.com Git - pdf.js.git/commitdiff
Fix putImageData. Needs to be copied byte by byte.
authorJulian Viereck <julian.viereck@gmail.com>
Wed, 22 Jun 2011 20:00:53 +0000 (22:00 +0200)
committerJulian Viereck <julian.viereck@gmail.com>
Thu, 23 Jun 2011 21:33:24 +0000 (23:33 +0200)
viewer_worker.html

index f6d7f11e59c4bad7815ad10a70706ae844145e55..92806bc994957a58fa2a45b8724218458fd31d21 100644 (file)
@@ -44,12 +44,17 @@ var special = {
     },
 
     "$putImageData": function(imageData, x, y) {
-        // Ugly: getImageData is called here only to get an object of the right
-        // shape - we are not interessted in the data, as we set it the line
-        // afterwards to something custome.
-        // Can we do better here?
         var imgData = this.getImageData(0, 0, imageData.width, imageData.height);
-        imgData.data = imageData.data;
+
+        // Store the .data property to avaid property lookups.
+        var imageRealData = imageData.data;
+        var imgRealData = imgData.data;
+
+        // Copy over the imageData.
+        var len = imageRealData.length;
+        while (len--)
+            imgRealData[len] = imageRealData[len]
+
         this.putImageData(imgData, x, y);
     },
 
@@ -262,7 +267,7 @@ function open(url) {
         var data = req.mozResponseArrayBuffer || req.mozResponse ||
                    req.responseArrayBuffer || req.response;
         myWorker.postMessage(data);
-        showPage("13");
+        showPage("2");
       }
     };
     req.send(null);