]> git.parisson.com Git - pdf.js.git/commitdiff
Optimization of getComponents()
authornotmasteryet <async.processingjs@yahoo.com>
Wed, 31 Aug 2011 03:08:41 +0000 (22:08 -0500)
committernotmasteryet <async.processingjs@yahoo.com>
Wed, 31 Aug 2011 03:08:41 +0000 (22:08 -0500)
pdf.js

diff --git a/pdf.js b/pdf.js
index 3ad455d41f1a890d832902c316998a1e4645345c..833dd5dc0bf6e4d5f8bf071b01b08b40fb46e269 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -5513,6 +5513,8 @@ var DeviceRgbCS = (function() {
       return color;
     },
     getRgbBuffer: function rgbcs_getRgbBuffer(input, bits) {
+      if (bits == 8)
+        return input;
       var scale = 255 / ((1 << bits) - 1);
       var i, length = input.length;
       var rgbBuf = new Uint8Array(length);
@@ -5977,7 +5979,8 @@ var PDFImage = (function() {
 
       var length = width * height;
       var bufferPos = 0;
-      var output = new Uint16Array(length);
+      var output = bpc <= 8 ? new Uint8Array(length) :
+        bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
 
       if (bpc == 1) {
         var valueZero = 0, valueOne = 1;