Make the decryptAscii
helper function, in src/core/type1_parser.js
, slightly more efficient
By slicing the Uint8Array directly, rather than using the prototype and a `call` invocation, the runtime of `decryptAscii` is decreased slightly (~30% based on quick logging). The `decryptAscii` function is still less efficient than `decrypt`, however ASCII encoded Type1 font programs are sufficiently rare that it probably doesn't matter much (we've only seen *two* examples, issue 4630 and 11740).
This commit is contained in:
parent
938d519192
commit
8770ca3014
@ -437,7 +437,7 @@ var Type1Parser = (function Type1ParserClosure() {
|
|||||||
r = ((value + r) * c1 + c2) & ((1 << 16) - 1);
|
r = ((value + r) * c1 + c2) & ((1 << 16) - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Array.prototype.slice.call(decrypted, discardNumber, j);
|
return decrypted.slice(discardNumber, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSpecial(c) {
|
function isSpecial(c) {
|
||||||
|
@ -224,6 +224,15 @@ if (
|
|||||||
Number.isInteger = require("core-js/es/number/is-integer.js");
|
Number.isInteger = require("core-js/es/number/is-integer.js");
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
// Provides support for TypedArray.prototype.slice in legacy browsers.
|
||||||
|
// Support: IE
|
||||||
|
(function checkTypedArraySlice() {
|
||||||
|
if (Uint8Array.prototype.slice) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
require("core-js/es/typed-array/slice");
|
||||||
|
})();
|
||||||
|
|
||||||
// Support: IE, Safari<11, Chrome<63
|
// Support: IE, Safari<11, Chrome<63
|
||||||
(function checkPromise() {
|
(function checkPromise() {
|
||||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) {
|
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user