More sanity checks

This commit is contained in:
Artur Adib 2011-12-08 18:19:36 -05:00
parent a21030a502
commit fcbe4f13d1

View File

@ -200,7 +200,7 @@ var PDFImage = (function pdfImage() {
// Is there a one-to-one correspondence between pixels in the loop below?
if (length !== 4*comps.length/3)
error('Number of image pixels mismatch');
error('Number of image pixels mismatch (RGB)');
for (var i = 0; i < length; i += 4) {
buffer[i] = comps[compsPos++];
@ -226,6 +226,10 @@ var PDFImage = (function pdfImage() {
var comps = this.getComponents(imgArray);
var length = width * height;
// Is there a one-to-one correspondence between pixels in the loop below?
if (length !== comps.length)
error('Number of image pixels mismatch (Gray)');
for (var i = 0; i < length; ++i)
buffer[i] = comps[i];
}