1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Remove the isStream helper function

At this point all the various Stream-classes extends an abstract base-class, hence this helper function is no longer necessary and only adds unnecessary indirection in the code.
This commit is contained in:
Jonas Jenwald 2022-02-17 13:45:42 +01:00
parent d9a3a24353
commit 1a31855977
15 changed files with 51 additions and 80 deletions

View file

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { Dict, isDict, isStream, Ref } from "./primitives.js";
import { Dict, isDict, Ref } from "./primitives.js";
import {
FormatError,
info,
@ -23,6 +23,7 @@ import {
unreachable,
} from "../shared/util.js";
import { PostScriptLexer, PostScriptParser } from "./ps_parser.js";
import { BaseStream } from "./base_stream.js";
import { LocalFunctionCache } from "./image_utils.js";
class PDFFunctionFactory {
@ -71,7 +72,7 @@ class PDFFunctionFactory {
fnRef = cacheKey;
} else if (cacheKey instanceof Dict) {
fnRef = cacheKey.objId;
} else if (isStream(cacheKey)) {
} else if (cacheKey instanceof BaseStream) {
fnRef = cacheKey.dict && cacheKey.dict.objId;
}
if (fnRef) {
@ -97,7 +98,7 @@ class PDFFunctionFactory {
fnRef = cacheKey;
} else if (cacheKey instanceof Dict) {
fnRef = cacheKey.objId;
} else if (isStream(cacheKey)) {
} else if (cacheKey instanceof BaseStream) {
fnRef = cacheKey.dict && cacheKey.dict.objId;
}
if (fnRef) {
@ -509,7 +510,7 @@ function isPDFFunction(v) {
return false;
} else if (isDict(v)) {
fnDict = v;
} else if (isStream(v)) {
} else if (v instanceof BaseStream) {
fnDict = v.dict;
} else {
return false;