mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Adds color components decoding to the JPEG
This commit is contained in:
parent
2449142fc3
commit
6235e3a61c
2 changed files with 32 additions and 5 deletions
|
@ -811,7 +811,7 @@ var JpegImage = (function jpegImage() {
|
|||
var scaleX = this.width / width, scaleY = this.height / height;
|
||||
|
||||
var component, componentScaleX, componentScaleY, blocksPerScanline;
|
||||
var x, y, i, j;
|
||||
var x, y, i, j, k;
|
||||
var index;
|
||||
var offset = 0;
|
||||
var output;
|
||||
|
@ -843,6 +843,17 @@ var JpegImage = (function jpegImage() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// decodeTransform will contains pairs of multiplier (-256..256) and
|
||||
// additive
|
||||
var transform = this.decodeTransform;
|
||||
if (transform) {
|
||||
for (i = 0; i < dataLength;) {
|
||||
for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
|
||||
data[i] = ((data[i] * transform[k]) >> 8) + transform[k + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
|
@ -852,8 +863,6 @@ var JpegImage = (function jpegImage() {
|
|||
return true;
|
||||
} else if (this.numComponents == 3) {
|
||||
return true;
|
||||
} else if (typeof this.colorTransform !== 'undefined') {
|
||||
return !!this.colorTransform;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue