From c044652320ee91525fd7961dbe6ad7d943486b6d Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 16 Jan 2014 18:03:17 -0800 Subject: [PATCH] Remove unneeded srcOffset arguments from createRgbBuffer. --- src/core/image.js | 2 +- src/shared/colorspace.js | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/image.js b/src/core/image.js index 8d0411633..56cf9b471 100644 --- a/src/core/image.js +++ b/src/core/image.js @@ -439,7 +439,7 @@ var PDFImage = (function PDFImageClosure() { if (this.needsDecode) { this.decodeBuffer(comps); } - var rgbBuf = this.colorSpace.createRgbBuffer(comps, 0, + var rgbBuf = this.colorSpace.createRgbBuffer(comps, originalWidth * originalHeight, bpc); if (originalWidth != width || originalHeight != height) rgbBuf = PDFImage.resize(rgbBuf, this.bpc, 3, originalWidth, diff --git a/src/shared/colorspace.js b/src/shared/colorspace.js index 6f9a2d5c7..833cfc6b0 100644 --- a/src/shared/colorspace.js +++ b/src/shared/colorspace.js @@ -69,10 +69,9 @@ var ColorSpace = (function ColorSpaceClosure() { * Creates the output buffer and converts the specified number of the color * values to the RGB colors, similar to the getRgbBuffer. */ - createRgbBuffer: function ColorSpace_createRgbBuffer(src, srcOffset, - count, bits) { + createRgbBuffer: function ColorSpace_createRgbBuffer(src, count, bits) { if (this.isPassthrough(bits)) { - return src.subarray(srcOffset); + return src; } var dest = new Uint8Array(count * 3); var numComponentColors = 1 << bits; @@ -96,14 +95,14 @@ var ColorSpace = (function ColorSpaceClosure() { var destOffset = 0; for (var i = 0; i < count; ++i) { - var key = src[srcOffset++] * 3; + var key = src[i] * 3; dest[destOffset++] = colorMap[key]; dest[destOffset++] = colorMap[key + 1]; dest[destOffset++] = colorMap[key + 2]; } return dest; } - this.getRgbBuffer(src, srcOffset, count, dest, 0, bits); + this.getRgbBuffer(src, 0, count, dest, 0, bits); return dest; }, /**