mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-05 06:35:48 +02:00
Merge pull request #21537 from Snuffleupagus/getComponents-MathClamp
Use the `MathClamp` helper in the `PDFImage.prototype.getComponents` method
This commit is contained in:
commit
36835d919d
@ -579,13 +579,7 @@ class PDFImage {
|
||||
}
|
||||
|
||||
const remainingBits = bits - bpc;
|
||||
let value = buf >> remainingBits;
|
||||
if (value < 0) {
|
||||
value = 0;
|
||||
} else if (value > max) {
|
||||
value = max;
|
||||
}
|
||||
output[i] = value;
|
||||
output[i] = MathClamp(buf >> remainingBits, 0, max);
|
||||
buf &= (1 << remainingBits) - 1;
|
||||
bits = remainingBits;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user