Browse Source

Remove unneeded srcOffset arguments from createRgbBuffer.

Nicholas Nethercote 11 years ago
parent
commit
c044652320
  1. 2
      src/core/image.js
  2. 9
      src/shared/colorspace.js

2
src/core/image.js

@ -439,7 +439,7 @@ var PDFImage = (function PDFImageClosure() {
if (this.needsDecode) { if (this.needsDecode) {
this.decodeBuffer(comps); this.decodeBuffer(comps);
} }
var rgbBuf = this.colorSpace.createRgbBuffer(comps, 0, var rgbBuf = this.colorSpace.createRgbBuffer(comps,
originalWidth * originalHeight, bpc); originalWidth * originalHeight, bpc);
if (originalWidth != width || originalHeight != height) if (originalWidth != width || originalHeight != height)
rgbBuf = PDFImage.resize(rgbBuf, this.bpc, 3, originalWidth, rgbBuf = PDFImage.resize(rgbBuf, this.bpc, 3, originalWidth,

9
src/shared/colorspace.js

@ -69,10 +69,9 @@ var ColorSpace = (function ColorSpaceClosure() {
* Creates the output buffer and converts the specified number of the color * Creates the output buffer and converts the specified number of the color
* values to the RGB colors, similar to the getRgbBuffer. * values to the RGB colors, similar to the getRgbBuffer.
*/ */
createRgbBuffer: function ColorSpace_createRgbBuffer(src, srcOffset, createRgbBuffer: function ColorSpace_createRgbBuffer(src, count, bits) {
count, bits) {
if (this.isPassthrough(bits)) { if (this.isPassthrough(bits)) {
return src.subarray(srcOffset); return src;
} }
var dest = new Uint8Array(count * 3); var dest = new Uint8Array(count * 3);
var numComponentColors = 1 << bits; var numComponentColors = 1 << bits;
@ -96,14 +95,14 @@ var ColorSpace = (function ColorSpaceClosure() {
var destOffset = 0; var destOffset = 0;
for (var i = 0; i < count; ++i) { 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];
dest[destOffset++] = colorMap[key + 1]; dest[destOffset++] = colorMap[key + 1];
dest[destOffset++] = colorMap[key + 2]; dest[destOffset++] = colorMap[key + 2];
} }
return dest; return dest;
} }
this.getRgbBuffer(src, srcOffset, count, dest, 0, bits); this.getRgbBuffer(src, 0, count, dest, 0, bits);
return dest; return dest;
}, },
/** /**

Loading…
Cancel
Save