[Pkg-javascript-commits] [pdf.js] 145/210: Optimized colorspace.js AlternateCS_getRgbBuffer

David Prévot taffit at moszumanska.debian.org
Thu Jun 5 14:21:11 UTC 2014


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

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

commit 8cfd024e484cc5d1b63bb76a6e7b319be3393ca4
Author: p01 <p01 at opera.com>
Date:   Thu May 8 17:31:11 2014 +0200

    Optimized colorspace.js AlternateCS_getRgbBuffer
---
 src/shared/colorspace.js | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/shared/colorspace.js b/src/shared/colorspace.js
index aa49a2d..0d1b671 100644
--- a/src/shared/colorspace.js
+++ b/src/shared/colorspace.js
@@ -396,6 +396,7 @@ var AlternateCS = (function AlternateCSClosure() {
     getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count,
                                                     dest, destOffset, bits,
                                                     alpha01) {
+      var tinted;
       var tintFn = this.tintFn;
       var base = this.base;
       var scale = 1 / ((1 << bits) - 1);
@@ -409,16 +410,22 @@ var AlternateCS = (function AlternateCSClosure() {
 
       var scaled = new Float32Array(numComps);
       var i, j;
-      for (i = 0; i < count; i++) {
-        for (j = 0; j < numComps; j++) {
-          scaled[j] = src[srcOffset++] * scale;
-        }
-        var tinted = tintFn(scaled);
-        if (usesZeroToOneRange) {
+      if (usesZeroToOneRange) {
+        for (i = 0; i < count; i++) {
+          for (j = 0; j < numComps; j++) {
+            scaled[j] = src[srcOffset++] * scale;
+          }
+          tinted = tintFn(scaled);
           for (j = 0; j < baseNumComps; j++) {
             baseBuf[pos++] = tinted[j] * 255;
           }
-        } else {
+        }
+      } else {
+        for (i = 0; i < count; i++) {
+          for (j = 0; j < numComps; j++) {
+            scaled[j] = src[srcOffset++] * scale;
+          }
+          tinted = tintFn(scaled);
           base.getRgbItem(tinted, 0, baseBuf, pos);
           pos += baseNumComps;
         }

-- 
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