mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-06 15:15:47 +02:00
Use the MathClamp helper in the PDFImage.prototype.getComponents method
This commit is contained in:
parent
5b100c4509
commit
be90aa4f46
@ -579,13 +579,7 @@ class PDFImage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const remainingBits = bits - bpc;
|
const remainingBits = bits - bpc;
|
||||||
let value = buf >> remainingBits;
|
output[i] = MathClamp(buf >> remainingBits, 0, max);
|
||||||
if (value < 0) {
|
|
||||||
value = 0;
|
|
||||||
} else if (value > max) {
|
|
||||||
value = max;
|
|
||||||
}
|
|
||||||
output[i] = value;
|
|
||||||
buf &= (1 << remainingBits) - 1;
|
buf &= (1 << remainingBits) - 1;
|
||||||
bits = remainingBits;
|
bits = remainingBits;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user