[Pkg-javascript-commits] [pdf.js] 31/161: Process only once the offset and starting mask JBIG2's drawBitmap

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 14:16:20 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit b2b3836683ec5915c65e35c64045b151c2eea541
Author: p01 <p01 at opera.com>
Date:   Fri Mar 7 17:29:14 2014 +0100

    Process only once the offset and starting mask JBIG2's drawBitmap
---
 src/core/jbig2.js | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/core/jbig2.js b/src/core/jbig2.js
index 14ca23c..35f0a47 100755
--- a/src/core/jbig2.js
+++ b/src/core/jbig2.js
@@ -961,11 +961,13 @@ var Jbig2Image = (function Jbig2ImageClosure() {
       var combinationOperator = pageInfo.combinationOperatorOverride ?
         regionInfo.combinationOperator : pageInfo.combinationOperator;
       var buffer = this.buffer;
+      var mask0 =  128 >> (regionInfo.x & 7);
+      var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
       switch (combinationOperator) {
         case 0: // OR
           for (var i = 0; i < height; i++) {
-            var mask = 128 >> (regionInfo.x & 7);
-            var offset = (i + regionInfo.y) * rowSize + (regionInfo.x >> 3);
+            var mask = mask0;
+            var offset = offset0;
             for (var j = 0; j < width; j++) {
               if (bitmap[i][j]) {
                 buffer[offset] |= mask;
@@ -976,12 +978,13 @@ var Jbig2Image = (function Jbig2ImageClosure() {
                 offset++;
               }
             }
+            offset0 += rowSize;
           }
         break;
         case 2: // XOR
           for (var i = 0; i < height; i++) {
-            var mask = 128 >> (regionInfo.x & 7);
-            var offset = (i + regionInfo.y) * rowSize + (regionInfo.x >> 3);
+            var mask = mask0;
+            var offset = offset0;
             for (var j = 0; j < width; j++) {
               if (bitmap[i][j]) {
                 buffer[offset] ^= mask;
@@ -992,6 +995,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
                 offset++;
               }
             }
+            offset0 += rowSize;
           }
           break;
         default:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list