1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

Don't create the RGB buffer for images that don't need resizing.

This commit is contained in:
Nicholas Nethercote 2014-01-16 18:29:33 -08:00
parent c044652320
commit 0685214a77
2 changed files with 134 additions and 83 deletions

View file

@ -439,20 +439,9 @@ var PDFImage = (function PDFImageClosure() {
if (this.needsDecode) {
this.decodeBuffer(comps);
}
var rgbBuf = this.colorSpace.createRgbBuffer(comps,
originalWidth * originalHeight, bpc);
if (originalWidth != width || originalHeight != height)
rgbBuf = PDFImage.resize(rgbBuf, this.bpc, 3, originalWidth,
originalHeight, width, height);
var compsPos = 0;
var length = width * actualHeight * 4;
for (var i = 0; i < length; i += 4) {
buffer[i] = rgbBuf[compsPos++];
buffer[i + 1] = rgbBuf[compsPos++];
buffer[i + 2] = rgbBuf[compsPos++];
// buffer[i + 3] was filled by fillOpacity().
}
this.colorSpace.fillRgb(buffer, originalWidth, originalHeight, width,
height, actualHeight, bpc, comps);
this.undoPreblend(buffer, width, actualHeight);
},