Merge 602824ba0f7addc08c78bb7c0d26baed162d0b11 into e20ee9958081a06ac91808ffe5726f3db62a7b3a
This commit is contained in:
commit
c3d27a220c
@ -386,15 +386,34 @@ class AlternateCS extends ColorSpace {
|
|||||||
: new Uint8ClampedArray(baseNumComps * count);
|
: new Uint8ClampedArray(baseNumComps * count);
|
||||||
const numComps = this.numComps;
|
const numComps = this.numComps;
|
||||||
|
|
||||||
|
const tintCache = new Map();
|
||||||
|
// Use an integer cache-key when possible, since that's a lot faster than
|
||||||
|
// string concatenation.
|
||||||
|
const int32Key =
|
||||||
|
numComps <= 4 &&
|
||||||
|
(src instanceof Uint8Array || src instanceof Uint8ClampedArray);
|
||||||
|
|
||||||
const scaled = new Float32Array(numComps);
|
const scaled = new Float32Array(numComps);
|
||||||
const tinted = new Float32Array(baseNumComps);
|
const tinted = new Float32Array(baseNumComps);
|
||||||
let i, j;
|
let i, j, key, val;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
|
key = int32Key ? 0 : "";
|
||||||
|
|
||||||
for (j = 0; j < numComps; j++) {
|
for (j = 0; j < numComps; j++) {
|
||||||
scaled[j] = src[srcOffset++] * scale;
|
val = src[srcOffset++];
|
||||||
|
scaled[j] = val * scale;
|
||||||
|
|
||||||
|
key += int32Key ? val << (8 * j) : val + "_";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cached = tintCache.get(key);
|
||||||
|
if (cached) {
|
||||||
|
baseBuf.set(cached, pos);
|
||||||
|
pos += baseNumComps;
|
||||||
|
} else {
|
||||||
tintFn(scaled, 0, tinted, 0);
|
tintFn(scaled, 0, tinted, 0);
|
||||||
|
|
||||||
if (usesZeroToOneRange) {
|
if (usesZeroToOneRange) {
|
||||||
for (j = 0; j < baseNumComps; j++) {
|
for (j = 0; j < baseNumComps; j++) {
|
||||||
baseBuf[pos++] = tinted[j] * 255;
|
baseBuf[pos++] = tinted[j] * 255;
|
||||||
@ -403,7 +422,10 @@ class AlternateCS extends ColorSpace {
|
|||||||
base.getRgbItem(tinted, 0, baseBuf, pos);
|
base.getRgbItem(tinted, 0, baseBuf, pos);
|
||||||
pos += baseNumComps;
|
pos += baseNumComps;
|
||||||
}
|
}
|
||||||
|
tintCache.set(key, baseBuf.slice(pos - baseNumComps, pos));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
tintCache.clear();
|
||||||
|
|
||||||
if (!isPassthrough) {
|
if (!isPassthrough) {
|
||||||
base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
|
base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
|
||||||
|
|||||||
@ -392,12 +392,11 @@ class PDFFunction {
|
|||||||
// seen in our tests.
|
// seen in our tests.
|
||||||
const MAX_CACHE_SIZE = 2048 * 4;
|
const MAX_CACHE_SIZE = 2048 * 4;
|
||||||
let cache_available = MAX_CACHE_SIZE;
|
let cache_available = MAX_CACHE_SIZE;
|
||||||
const tmpBuf = new Float32Array(numInputs);
|
const input = new Float32Array(numInputs);
|
||||||
|
|
||||||
return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
|
return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
|
||||||
let i, value;
|
let i, value;
|
||||||
let key = "";
|
let key = "";
|
||||||
const input = tmpBuf;
|
|
||||||
for (i = 0; i < numInputs; i++) {
|
for (i = 0; i < numInputs; i++) {
|
||||||
value = src[srcOffset + i];
|
value = src[srcOffset + i];
|
||||||
input[i] = value;
|
input[i] = value;
|
||||||
|
|||||||
@ -165,7 +165,7 @@ const RENDERING_CANCELLED_TIMEOUT = 100; // ms
|
|||||||
* Use -1 for no limit, which is also the default value.
|
* Use -1 for no limit, which is also the default value.
|
||||||
* @property {boolean} [isEvalSupported] - Determines if we can evaluate strings
|
* @property {boolean} [isEvalSupported] - Determines if we can evaluate strings
|
||||||
* as JavaScript. Primarily used to improve performance of PDF functions.
|
* as JavaScript. Primarily used to improve performance of PDF functions.
|
||||||
* The default value is `true`.
|
* The default value is `false`.
|
||||||
* @property {boolean} [isOffscreenCanvasSupported] - Determines if we can use
|
* @property {boolean} [isOffscreenCanvasSupported] - Determines if we can use
|
||||||
* `OffscreenCanvas` in the worker. Primarily used to improve performance of
|
* `OffscreenCanvas` in the worker. Primarily used to improve performance of
|
||||||
* image conversion/rendering.
|
* image conversion/rendering.
|
||||||
@ -295,7 +295,7 @@ function getDocument(src = {}) {
|
|||||||
Number.isInteger(src.maxImageSize) && src.maxImageSize > -1
|
Number.isInteger(src.maxImageSize) && src.maxImageSize > -1
|
||||||
? src.maxImageSize
|
? src.maxImageSize
|
||||||
: -1;
|
: -1;
|
||||||
const isEvalSupported = src.isEvalSupported !== false;
|
const isEvalSupported = src.isEvalSupported === true;
|
||||||
const isOffscreenCanvasSupported =
|
const isOffscreenCanvasSupported =
|
||||||
typeof src.isOffscreenCanvasSupported === "boolean"
|
typeof src.isOffscreenCanvasSupported === "boolean"
|
||||||
? src.isOffscreenCanvasSupported
|
? src.isOffscreenCanvasSupported
|
||||||
|
|||||||
1
test/pdfs/pr5134.pdf.link
Normal file
1
test/pdfs/pr5134.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
https://web.archive.org/web/20140211020222/http://www.coachusa.com/CoachUsaAssets/files/97/route45.pdf
|
||||||
@ -2269,6 +2269,15 @@
|
|||||||
"lastPage": 1,
|
"lastPage": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "pr5134",
|
||||||
|
"file": "pdfs/pr5134.pdf",
|
||||||
|
"md5": "6a701a163472e071a2519348b55cbac1",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": true,
|
||||||
|
"firstPage": 2,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "issue5599",
|
"id": "issue5599",
|
||||||
"file": "pdfs/issue5599.pdf",
|
"file": "pdfs/issue5599.pdf",
|
||||||
|
|||||||
@ -450,7 +450,7 @@ const defaultOptions = {
|
|||||||
},
|
},
|
||||||
isEvalSupported: {
|
isEvalSupported: {
|
||||||
/** @type {boolean} */
|
/** @type {boolean} */
|
||||||
value: true,
|
value: false,
|
||||||
kind: OptionKind.API,
|
kind: OptionKind.API,
|
||||||
},
|
},
|
||||||
isOffscreenCanvasSupported: {
|
isOffscreenCanvasSupported: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user