Removes core/stream circular dependency on core/parser.
This commit is contained in:
parent
21ed8ff71d
commit
6038c236b2
@ -1116,7 +1116,4 @@ exports.Lexer = Lexer;
|
|||||||
exports.Linearization = Linearization;
|
exports.Linearization = Linearization;
|
||||||
exports.Parser = Parser;
|
exports.Parser = Parser;
|
||||||
exports.isEOF = isEOF;
|
exports.isEOF = isEOF;
|
||||||
|
|
||||||
// TODO refactor to remove dependency on stream.js
|
|
||||||
coreStream._setCoreParser(exports);
|
|
||||||
}));
|
}));
|
||||||
|
@ -43,10 +43,6 @@ var Jbig2Image = coreJbig2.Jbig2Image;
|
|||||||
var JpegImage = coreJpg.JpegImage;
|
var JpegImage = coreJpg.JpegImage;
|
||||||
var JpxImage = coreJpx.JpxImage;
|
var JpxImage = coreJpx.JpxImage;
|
||||||
|
|
||||||
var coreParser; // see _setCoreParser below
|
|
||||||
var EOF; // = coreParser.EOF;
|
|
||||||
var Lexer; // = coreParser.Lexer;
|
|
||||||
|
|
||||||
var coreColorSpace; // see _setCoreColorSpace below
|
var coreColorSpace; // see _setCoreColorSpace below
|
||||||
var ColorSpace; // = coreColorSpace.ColorSpace;
|
var ColorSpace; // = coreColorSpace.ColorSpace;
|
||||||
|
|
||||||
@ -1168,6 +1164,11 @@ var DecryptStream = (function DecryptStreamClosure() {
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
var Ascii85Stream = (function Ascii85StreamClosure() {
|
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) {
|
function Ascii85Stream(str, maybeLength) {
|
||||||
this.str = str;
|
this.str = str;
|
||||||
this.dict = str.dict;
|
this.dict = str.dict;
|
||||||
@ -1191,7 +1192,7 @@ var Ascii85Stream = (function Ascii85StreamClosure() {
|
|||||||
var str = this.str;
|
var str = this.str;
|
||||||
|
|
||||||
var c = str.getByte();
|
var c = str.getByte();
|
||||||
while (Lexer.isSpace(c)) {
|
while (isSpace(c)) {
|
||||||
c = str.getByte();
|
c = str.getByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1215,7 +1216,7 @@ var Ascii85Stream = (function Ascii85StreamClosure() {
|
|||||||
input[0] = c;
|
input[0] = c;
|
||||||
for (i = 1; i < 5; ++i) {
|
for (i = 1; i < 5; ++i) {
|
||||||
c = str.getByte();
|
c = str.getByte();
|
||||||
while (Lexer.isSpace(c)) {
|
while (isSpace(c)) {
|
||||||
c = str.getByte();
|
c = str.getByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1362,6 +1363,7 @@ var RunLengthStream = (function RunLengthStreamClosure() {
|
|||||||
var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
||||||
|
|
||||||
var ccittEOL = -2;
|
var ccittEOL = -2;
|
||||||
|
var ccittEOF = -1;
|
||||||
var twoDimPass = 0;
|
var twoDimPass = 0;
|
||||||
var twoDimHoriz = 1;
|
var twoDimHoriz = 1;
|
||||||
var twoDimVert0 = 2;
|
var twoDimVert0 = 2;
|
||||||
@ -2044,7 +2046,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EOF:
|
case ccittEOF:
|
||||||
this.addPixels(columns, 0);
|
this.addPixels(columns, 0);
|
||||||
this.eof = true;
|
this.eof = true;
|
||||||
break;
|
break;
|
||||||
@ -2085,7 +2087,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||||||
} else {
|
} else {
|
||||||
code1 = this.lookBits(12);
|
code1 = this.lookBits(12);
|
||||||
if (this.eoline) {
|
if (this.eoline) {
|
||||||
while (code1 !== EOF && code1 !== 1) {
|
while (code1 !== ccittEOF && code1 !== 1) {
|
||||||
this.eatBits(1);
|
this.eatBits(1);
|
||||||
code1 = this.lookBits(12);
|
code1 = this.lookBits(12);
|
||||||
}
|
}
|
||||||
@ -2098,7 +2100,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||||||
if (code1 === 1) {
|
if (code1 === 1) {
|
||||||
this.eatBits(12);
|
this.eatBits(12);
|
||||||
gotEOL = true;
|
gotEOL = true;
|
||||||
} else if (code1 === EOF) {
|
} else if (code1 === ccittEOF) {
|
||||||
this.eof = true;
|
this.eof = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2134,7 +2136,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||||||
} else if (this.err && this.eoline) {
|
} else if (this.err && this.eoline) {
|
||||||
while (true) {
|
while (true) {
|
||||||
code1 = this.lookBits(13);
|
code1 = this.lookBits(13);
|
||||||
if (code1 === EOF) {
|
if (code1 === ccittEOF) {
|
||||||
this.eof = true;
|
this.eof = true;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -2214,7 +2216,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||||||
var limitValue = limit || 0;
|
var limitValue = limit || 0;
|
||||||
for (var i = start; i <= end; ++i) {
|
for (var i = start; i <= end; ++i) {
|
||||||
var code = this.lookBits(i);
|
var code = this.lookBits(i);
|
||||||
if (code === EOF) {
|
if (code === ccittEOF) {
|
||||||
return [true, 1, false];
|
return [true, 1, false];
|
||||||
}
|
}
|
||||||
if (i < end) {
|
if (i < end) {
|
||||||
@ -2250,7 +2252,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
info('Bad two dim code');
|
info('Bad two dim code');
|
||||||
return EOF;
|
return ccittEOF;
|
||||||
};
|
};
|
||||||
|
|
||||||
CCITTFaxStream.prototype.getWhiteCode =
|
CCITTFaxStream.prototype.getWhiteCode =
|
||||||
@ -2260,7 +2262,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||||||
var p;
|
var p;
|
||||||
if (this.eoblock) {
|
if (this.eoblock) {
|
||||||
code = this.lookBits(12);
|
code = this.lookBits(12);
|
||||||
if (code === EOF) {
|
if (code === ccittEOF) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2296,7 +2298,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||||||
var code, p;
|
var code, p;
|
||||||
if (this.eoblock) {
|
if (this.eoblock) {
|
||||||
code = this.lookBits(13);
|
code = this.lookBits(13);
|
||||||
if (code === EOF) {
|
if (code === ccittEOF) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if ((code >> 7) === 0) {
|
if ((code >> 7) === 0) {
|
||||||
@ -2337,12 +2339,12 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||||||
while (this.inputBits < n) {
|
while (this.inputBits < n) {
|
||||||
if ((c = this.str.getByte()) === -1) {
|
if ((c = this.str.getByte()) === -1) {
|
||||||
if (this.inputBits === 0) {
|
if (this.inputBits === 0) {
|
||||||
return EOF;
|
return ccittEOF;
|
||||||
}
|
}
|
||||||
return ((this.inputBuf << (n - this.inputBits)) &
|
return ((this.inputBuf << (n - this.inputBits)) &
|
||||||
(0xFFFF >> (16 - n)));
|
(0xFFFF >> (16 - n)));
|
||||||
}
|
}
|
||||||
this.inputBuf = (this.inputBuf << 8) + c;
|
this.inputBuf = (this.inputBuf << 8) | c;
|
||||||
this.inputBits += 8;
|
this.inputBits += 8;
|
||||||
}
|
}
|
||||||
return (this.inputBuf >> (this.inputBits - n)) & (0xFFFF >> (16 - n));
|
return (this.inputBuf >> (this.inputBits - n)) & (0xFFFF >> (16 - n));
|
||||||
@ -2498,14 +2500,6 @@ var NullStream = (function NullStreamClosure() {
|
|||||||
return NullStream;
|
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
|
// TODO refactor to remove dependency on colorspace.js
|
||||||
function _setCoreColorSpace(coreColorSpace_) {
|
function _setCoreColorSpace(coreColorSpace_) {
|
||||||
coreColorSpace = coreColorSpace_;
|
coreColorSpace = coreColorSpace_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user