commit
997e71b52b
@ -161,7 +161,6 @@ var Page = (function pagePage() {
|
|||||||
var self = this;
|
var self = this;
|
||||||
this.IRQueue = IRQueue;
|
this.IRQueue = IRQueue;
|
||||||
var gfx = new CanvasGraphics(this.ctx, this.objs);
|
var gfx = new CanvasGraphics(this.ctx, this.objs);
|
||||||
var startTime = Date.now();
|
|
||||||
|
|
||||||
var displayContinuation = function pageDisplayContinuation() {
|
var displayContinuation = function pageDisplayContinuation() {
|
||||||
// Always defer call to display() to work around bug in
|
// Always defer call to display() to work around bug in
|
||||||
@ -242,7 +241,6 @@ var Page = (function pagePage() {
|
|||||||
var IRQueue = this.IRQueue;
|
var IRQueue = this.IRQueue;
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var startTime = Date.now();
|
|
||||||
function next() {
|
function next() {
|
||||||
startIdx = gfx.executeIRQueue(IRQueue, startIdx, next);
|
startIdx = gfx.executeIRQueue(IRQueue, startIdx, next);
|
||||||
if (startIdx == length) {
|
if (startIdx == length) {
|
||||||
|
@ -26,7 +26,6 @@ var ARCFourCipher = (function arcFourCipher() {
|
|||||||
var a = this.a, b = this.b, s = this.s;
|
var a = this.a, b = this.b, s = this.s;
|
||||||
var output = new Uint8Array(n);
|
var output = new Uint8Array(n);
|
||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
var tmp;
|
|
||||||
a = (a + 1) & 0xFF;
|
a = (a + 1) & 0xFF;
|
||||||
tmp = s[a];
|
tmp = s[a];
|
||||||
b = (b + tmp) & 0xFF;
|
b = (b + tmp) & 0xFF;
|
||||||
@ -75,8 +74,8 @@ var calculateMD5 = (function calculateMD5() {
|
|||||||
padded[i] = data[offset++];
|
padded[i] = data[offset++];
|
||||||
padded[i++] = 0x80;
|
padded[i++] = 0x80;
|
||||||
n = paddedLength - 8;
|
n = paddedLength - 8;
|
||||||
for (; i < n; ++i)
|
while (i < n)
|
||||||
padded[i] = 0;
|
padded[i++] = 0;
|
||||||
padded[i++] = (length << 3) & 0xFF;
|
padded[i++] = (length << 3) & 0xFF;
|
||||||
padded[i++] = (length >> 5) & 0xFF;
|
padded[i++] = (length >> 5) & 0xFF;
|
||||||
padded[i++] = (length >> 13) & 0xFF;
|
padded[i++] = (length >> 13) & 0xFF;
|
||||||
@ -322,12 +321,12 @@ var AES128Cipher = (function aes128Cipher() {
|
|||||||
state[10] = state[2]; state[6] = t; state[2] = u;
|
state[10] = state[2]; state[6] = t; state[2] = u;
|
||||||
t = state[15]; u = state[11]; v = state[7]; state[15] = state[3];
|
t = state[15]; u = state[11]; v = state[7]; state[15] = state[3];
|
||||||
state[11] = t; state[7] = u; state[3] = v;
|
state[11] = t; state[7] = u; state[3] = v;
|
||||||
// InvSubBytes
|
for (j = 0; j < 16; ++j) {
|
||||||
for (j = 0; j < 16; ++j)
|
// InvSubBytes
|
||||||
state[j] = inv_s[state[j]];
|
state[j] = inv_s[state[j]];
|
||||||
// AddRoundKey
|
// AddRoundKey
|
||||||
for (j = 0; j < 16; ++j)
|
|
||||||
state[j] ^= key[j];
|
state[j] ^= key[j];
|
||||||
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,11 +470,11 @@ var CipherTransformFactory = (function cipherTransformFactory() {
|
|||||||
cipher = new ARCFourCipher(encryptionKey);
|
cipher = new ARCFourCipher(encryptionKey);
|
||||||
var checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
|
var checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
|
||||||
n = encryptionKey.length;
|
n = encryptionKey.length;
|
||||||
var derrivedKey = new Uint8Array(n), k;
|
var derivedKey = new Uint8Array(n), k;
|
||||||
for (j = 1; j <= 19; ++j) {
|
for (j = 1; j <= 19; ++j) {
|
||||||
for (k = 0; k < n; ++k)
|
for (k = 0; k < n; ++k)
|
||||||
derrivedKey[k] = encryptionKey[k] ^ j;
|
derivedKey[k] = encryptionKey[k] ^ j;
|
||||||
cipher = new ARCFourCipher(derrivedKey);
|
cipher = new ARCFourCipher(derivedKey);
|
||||||
checkData = cipher.encryptBlock(checkData);
|
checkData = cipher.encryptBlock(checkData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -145,12 +145,12 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
var font = xref.fetchIfRef(fontRef);
|
var font = xref.fetchIfRef(fontRef);
|
||||||
assertWellFormed(isDict(font));
|
assertWellFormed(isDict(font));
|
||||||
if (!font.translated) {
|
if (!font.translated) {
|
||||||
font.translated = self.translateFont(font, xref, resources, handler,
|
font.translated = self.translateFont(font, xref, resources,
|
||||||
uniquePrefix, dependency);
|
dependency);
|
||||||
if (font.translated) {
|
if (font.translated) {
|
||||||
// keep track of each font we translated so the caller can
|
// keep track of each font we translated so the caller can
|
||||||
// load them asynchronously before calling display on a page
|
// load them asynchronously before calling display on a page
|
||||||
loadedName = 'font_' + uniquePrefix + ++self.objIdCounter;
|
loadedName = 'font_' + uniquePrefix + (++self.objIdCounter);
|
||||||
font.translated.properties.loadedName = loadedName;
|
font.translated.properties.loadedName = loadedName;
|
||||||
font.loadedName = loadedName;
|
font.loadedName = loadedName;
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
var h = dict.get('Height', 'H');
|
var h = dict.get('Height', 'H');
|
||||||
|
|
||||||
if (image instanceof JpegStream) {
|
if (image instanceof JpegStream) {
|
||||||
var objId = 'img_' + uniquePrefix + ++self.objIdCounter;
|
var objId = 'img_' + uniquePrefix + (++self.objIdCounter);
|
||||||
handler.send('obj', [objId, 'JpegStream', image.getIR()]);
|
handler.send('obj', [objId, 'JpegStream', image.getIR()]);
|
||||||
|
|
||||||
// Add the dependency on the image object.
|
// Add the dependency on the image object.
|
||||||
@ -470,7 +470,7 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
var glyphsWidths = {};
|
var glyphsWidths = {};
|
||||||
var widths = xref.fetchIfRef(dict.get('W'));
|
var widths = xref.fetchIfRef(dict.get('W'));
|
||||||
if (widths) {
|
if (widths) {
|
||||||
var start = 0, end = 0;
|
var start = 0;
|
||||||
for (var i = 0, ii = widths.length; i < ii; i++) {
|
for (var i = 0, ii = widths.length; i < ii; i++) {
|
||||||
var code = widths[i];
|
var code = widths[i];
|
||||||
if (isArray(code)) {
|
if (isArray(code)) {
|
||||||
@ -710,7 +710,8 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
// special case for symbols
|
// special case for symbols
|
||||||
var encoding = Encodings.symbolsEncoding.slice();
|
var encoding = Encodings.symbolsEncoding.slice();
|
||||||
for (var i = 0, n = encoding.length, j; i < n; i++) {
|
for (var i = 0, n = encoding.length, j; i < n; i++) {
|
||||||
if (!(j = encoding[i]))
|
j = encoding[i];
|
||||||
|
if (!j)
|
||||||
continue;
|
continue;
|
||||||
map[i] = GlyphsUnicode[j] || 0;
|
map[i] = GlyphsUnicode[j] || 0;
|
||||||
}
|
}
|
||||||
@ -731,7 +732,7 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
translateFont: function partialEvaluatorTranslateFont(dict, xref, resources,
|
translateFont: function partialEvaluatorTranslateFont(dict, xref, resources,
|
||||||
queue, handler, uniquePrefix, dependency) {
|
dependency) {
|
||||||
var baseDict = dict;
|
var baseDict = dict;
|
||||||
var type = dict.get('Subtype');
|
var type = dict.get('Subtype');
|
||||||
assertWellFormed(isName(type), 'invalid font Subtype');
|
assertWellFormed(isName(type), 'invalid font Subtype');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user