1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #19456 from Snuffleupagus/more-TypedArray-fill

Replace a couple of loops with `TypedArray.prototype.fill()`
This commit is contained in:
Jonas Jenwald 2025-02-09 17:45:17 +01:00 committed by GitHub
commit b4a6b1ba0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 10 deletions

View file

@ -252,12 +252,9 @@ class PDFFunction {
// Building the cube vertices: its part and sample index
// http://rjwagner49.com/Mathematics/Interpolation.pdf
const cubeVertices = 1 << inputSize;
const cubeN = new Float64Array(cubeVertices);
const cubeN = new Float64Array(cubeVertices).fill(1);
const cubeVertex = new Uint32Array(cubeVertices);
let i, j;
for (j = 0; j < cubeVertices; j++) {
cubeN[j] = 1;
}
let k = outputSize,
pos = 1;

View file

@ -805,9 +805,7 @@ function decodeTextRegion(
for (i = 0; i < height; i++) {
row = new Uint8Array(width);
if (defaultPixelValue) {
for (let j = 0; j < width; j++) {
row[j] = defaultPixelValue;
}
row.fill(defaultPixelValue);
}
bitmap.push(row);
}
@ -1041,9 +1039,7 @@ function decodeHalftoneRegion(
for (i = 0; i < regionHeight; i++) {
row = new Uint8Array(regionWidth);
if (defaultPixelValue) {
for (j = 0; j < regionWidth; j++) {
row[j] = defaultPixelValue;
}
row.fill(defaultPixelValue);
}
regionBitmap.push(row);
}