mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Removes core/stream circular dependency on core/parser.
This commit is contained in:
parent
21ed8ff71d
commit
6038c236b2
2 changed files with 18 additions and 27 deletions
|
@ -43,10 +43,6 @@ var Jbig2Image = coreJbig2.Jbig2Image;
|
|||
var JpegImage = coreJpg.JpegImage;
|
||||
var JpxImage = coreJpx.JpxImage;
|
||||
|
||||
var coreParser; // see _setCoreParser below
|
||||
var EOF; // = coreParser.EOF;
|
||||
var Lexer; // = coreParser.Lexer;
|
||||
|
||||
var coreColorSpace; // see _setCoreColorSpace below
|
||||
var ColorSpace; // = coreColorSpace.ColorSpace;
|
||||
|
||||
|
@ -1168,6 +1164,11 @@ var DecryptStream = (function DecryptStreamClosure() {
|
|||
})();
|
||||
|
||||
var Ascii85Stream = (function Ascii85StreamClosure() {
|
||||
// Checks if ch is one of the following characters: SPACE, TAB, CR or LF.
|
||||
function isSpace(ch) {
|
||||
return (ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A);
|
||||
}
|
||||
|
||||
function Ascii85Stream(str, maybeLength) {
|
||||
this.str = str;
|
||||
this.dict = str.dict;
|
||||
|
@ -1191,7 +1192,7 @@ var Ascii85Stream = (function Ascii85StreamClosure() {
|
|||
var str = this.str;
|
||||
|
||||
var c = str.getByte();
|
||||
while (Lexer.isSpace(c)) {
|
||||
while (isSpace(c)) {
|
||||
c = str.getByte();
|
||||
}
|
||||
|
||||
|
@ -1215,7 +1216,7 @@ var Ascii85Stream = (function Ascii85StreamClosure() {
|
|||
input[0] = c;
|
||||
for (i = 1; i < 5; ++i) {
|
||||
c = str.getByte();
|
||||
while (Lexer.isSpace(c)) {
|
||||
while (isSpace(c)) {
|
||||
c = str.getByte();
|
||||
}
|
||||
|
||||
|
@ -1362,6 +1363,7 @@ var RunLengthStream = (function RunLengthStreamClosure() {
|
|||
var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
||||
|
||||
var ccittEOL = -2;
|
||||
var ccittEOF = -1;
|
||||
var twoDimPass = 0;
|
||||
var twoDimHoriz = 1;
|
||||
var twoDimVert0 = 2;
|
||||
|
@ -2044,7 +2046,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case EOF:
|
||||
case ccittEOF:
|
||||
this.addPixels(columns, 0);
|
||||
this.eof = true;
|
||||
break;
|
||||
|
@ -2085,7 +2087,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||
} else {
|
||||
code1 = this.lookBits(12);
|
||||
if (this.eoline) {
|
||||
while (code1 !== EOF && code1 !== 1) {
|
||||
while (code1 !== ccittEOF && code1 !== 1) {
|
||||
this.eatBits(1);
|
||||
code1 = this.lookBits(12);
|
||||
}
|
||||
|
@ -2098,7 +2100,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||
if (code1 === 1) {
|
||||
this.eatBits(12);
|
||||
gotEOL = true;
|
||||
} else if (code1 === EOF) {
|
||||
} else if (code1 === ccittEOF) {
|
||||
this.eof = true;
|
||||
}
|
||||
}
|
||||
|
@ -2134,7 +2136,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||
} else if (this.err && this.eoline) {
|
||||
while (true) {
|
||||
code1 = this.lookBits(13);
|
||||
if (code1 === EOF) {
|
||||
if (code1 === ccittEOF) {
|
||||
this.eof = true;
|
||||
return null;
|
||||
}
|
||||
|
@ -2214,7 +2216,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||
var limitValue = limit || 0;
|
||||
for (var i = start; i <= end; ++i) {
|
||||
var code = this.lookBits(i);
|
||||
if (code === EOF) {
|
||||
if (code === ccittEOF) {
|
||||
return [true, 1, false];
|
||||
}
|
||||
if (i < end) {
|
||||
|
@ -2250,7 +2252,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||
}
|
||||
}
|
||||
info('Bad two dim code');
|
||||
return EOF;
|
||||
return ccittEOF;
|
||||
};
|
||||
|
||||
CCITTFaxStream.prototype.getWhiteCode =
|
||||
|
@ -2260,7 +2262,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||
var p;
|
||||
if (this.eoblock) {
|
||||
code = this.lookBits(12);
|
||||
if (code === EOF) {
|
||||
if (code === ccittEOF) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2296,7 +2298,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||
var code, p;
|
||||
if (this.eoblock) {
|
||||
code = this.lookBits(13);
|
||||
if (code === EOF) {
|
||||
if (code === ccittEOF) {
|
||||
return 1;
|
||||
}
|
||||
if ((code >> 7) === 0) {
|
||||
|
@ -2337,12 +2339,12 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||
while (this.inputBits < n) {
|
||||
if ((c = this.str.getByte()) === -1) {
|
||||
if (this.inputBits === 0) {
|
||||
return EOF;
|
||||
return ccittEOF;
|
||||
}
|
||||
return ((this.inputBuf << (n - this.inputBits)) &
|
||||
(0xFFFF >> (16 - n)));
|
||||
}
|
||||
this.inputBuf = (this.inputBuf << 8) + c;
|
||||
this.inputBuf = (this.inputBuf << 8) | c;
|
||||
this.inputBits += 8;
|
||||
}
|
||||
return (this.inputBuf >> (this.inputBits - n)) & (0xFFFF >> (16 - n));
|
||||
|
@ -2498,14 +2500,6 @@ var NullStream = (function NullStreamClosure() {
|
|||
return NullStream;
|
||||
})();
|
||||
|
||||
// TODO refactor to remove dependency on parser.js
|
||||
function _setCoreParser(coreParser_) {
|
||||
coreParser = coreParser_;
|
||||
EOF = coreParser_.EOF;
|
||||
Lexer = coreParser_.Lexer;
|
||||
}
|
||||
exports._setCoreParser = _setCoreParser;
|
||||
|
||||
// TODO refactor to remove dependency on colorspace.js
|
||||
function _setCoreColorSpace(coreColorSpace_) {
|
||||
coreColorSpace = coreColorSpace_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue