Merge pull request #19456 from Snuffleupagus/more-TypedArray-fill
Replace a couple of loops with `TypedArray.prototype.fill()`
This commit is contained in:
commit
b4a6b1ba0b
@ -252,12 +252,9 @@ class PDFFunction {
|
|||||||
// Building the cube vertices: its part and sample index
|
// Building the cube vertices: its part and sample index
|
||||||
// http://rjwagner49.com/Mathematics/Interpolation.pdf
|
// http://rjwagner49.com/Mathematics/Interpolation.pdf
|
||||||
const cubeVertices = 1 << inputSize;
|
const cubeVertices = 1 << inputSize;
|
||||||
const cubeN = new Float64Array(cubeVertices);
|
const cubeN = new Float64Array(cubeVertices).fill(1);
|
||||||
const cubeVertex = new Uint32Array(cubeVertices);
|
const cubeVertex = new Uint32Array(cubeVertices);
|
||||||
let i, j;
|
let i, j;
|
||||||
for (j = 0; j < cubeVertices; j++) {
|
|
||||||
cubeN[j] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
let k = outputSize,
|
let k = outputSize,
|
||||||
pos = 1;
|
pos = 1;
|
||||||
|
|||||||
@ -805,9 +805,7 @@ function decodeTextRegion(
|
|||||||
for (i = 0; i < height; i++) {
|
for (i = 0; i < height; i++) {
|
||||||
row = new Uint8Array(width);
|
row = new Uint8Array(width);
|
||||||
if (defaultPixelValue) {
|
if (defaultPixelValue) {
|
||||||
for (let j = 0; j < width; j++) {
|
row.fill(defaultPixelValue);
|
||||||
row[j] = defaultPixelValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bitmap.push(row);
|
bitmap.push(row);
|
||||||
}
|
}
|
||||||
@ -1041,9 +1039,7 @@ function decodeHalftoneRegion(
|
|||||||
for (i = 0; i < regionHeight; i++) {
|
for (i = 0; i < regionHeight; i++) {
|
||||||
row = new Uint8Array(regionWidth);
|
row = new Uint8Array(regionWidth);
|
||||||
if (defaultPixelValue) {
|
if (defaultPixelValue) {
|
||||||
for (j = 0; j < regionWidth; j++) {
|
row.fill(defaultPixelValue);
|
||||||
row[j] = defaultPixelValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
regionBitmap.push(row);
|
regionBitmap.push(row);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user