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

Move the colour conversion to jpg.js

Benchmarking shows that this improves performance for the invitation document
from https://github.com/mozilla/pdf.js/issues/3809 by 35%
This commit is contained in:
Thorben Bochenek 2014-03-27 17:08:32 +01:00
parent e7fe45a5c4
commit e8f0700bfa
7 changed files with 243 additions and 190 deletions

View file

@ -873,9 +873,8 @@ var JpegStream = (function JpegStreamClosure() {
jpegImage.colorTransform = this.colorTransform;
}
jpegImage.parse(this.bytes);
var width = jpegImage.width;
var height = jpegImage.height;
var data = jpegImage.getData(width, height);
var data = jpegImage.getData(this.drawWidth, this.drawHeight,
/* forceRGBoutput = */true);
this.buffer = data;
this.bufferLength = data.length;
this.eof = true;
@ -883,6 +882,12 @@ var JpegStream = (function JpegStreamClosure() {
error('JPEG error: ' + e);
}
};
JpegStream.prototype.getBytes = function JpegStream_getBytes(length) {
this.ensureBuffer();
return this.buffer;
};
JpegStream.prototype.getIR = function JpegStream_getIR() {
return PDFJS.createObjectURL(this.bytes, 'image/jpeg');
};