1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Change throws to errors.

This commit is contained in:
Kalervo Kujala 2012-01-24 22:04:59 +02:00
parent 67769f3741
commit 66e3441e0e
7 changed files with 42 additions and 38 deletions

View file

@ -821,15 +821,19 @@ var JpegStream = (function JpegStreamClosure() {
JpegStream.prototype.ensureBuffer = function jpegStreamEnsureBuffer(req) {
if (this.bufferLength)
return;
var jpegImage = new JpegImage();
if (this.colorTransform != -1)
jpegImage.colorTransform = this.colorTransform;
jpegImage.parse(this.bytes);
var width = jpegImage.width;
var height = jpegImage.height;
var data = jpegImage.getData(width, height);
this.buffer = data;
this.bufferLength = data.length;
try {
var jpegImage = new JpegImage();
if (this.colorTransform != -1)
jpegImage.colorTransform = this.colorTransform;
jpegImage.parse(this.bytes);
var width = jpegImage.width;
var height = jpegImage.height;
var data = jpegImage.getData(width, height);
this.buffer = data;
this.bufferLength = data.length;
} catch (e) {
error(e);
}
};
JpegStream.prototype.getIR = function jpegStreamGetIR() {
return bytesToString(this.bytes);