mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Merge pull request #5191 from nnethercote/getSampleArray-array-length
Right-size the array in getSampleArray().
This commit is contained in:
commit
9d87cbc516
1 changed files with 2 additions and 2 deletions
|
@ -35,7 +35,7 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||
}
|
||||
length *= outputSize;
|
||||
|
||||
var array = [];
|
||||
var array = new Array(length);
|
||||
var codeSize = 0;
|
||||
var codeBuf = 0;
|
||||
// 32 is a valid bps so shifting won't work
|
||||
|
@ -50,7 +50,7 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||
codeSize += 8;
|
||||
}
|
||||
codeSize -= bps;
|
||||
array.push((codeBuf >> codeSize) * sampleMul);
|
||||
array[i] = (codeBuf >> codeSize) * sampleMul;
|
||||
codeBuf &= (1 << codeSize) - 1;
|
||||
}
|
||||
return array;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue