Browse Source

PDF.js version 1.0.213

master v1.0.213
Yury Delendik 10 years ago
parent
commit
3c0014e967
  1. 2
      bower.json
  2. 118
      build/pdf.combined.js
  3. 106
      build/pdf.js
  4. 118
      build/pdf.worker.js
  5. 2
      package.json

2
bower.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.0.209", "version": "1.0.213",
"keywords": [ "keywords": [
"Mozilla", "Mozilla",
"pdf", "pdf",

118
build/pdf.combined.js

@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.0.209'; PDFJS.version = '1.0.213';
PDFJS.build = '0d8e3cc'; PDFJS.build = '7f6cb0e';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
@ -1941,6 +1941,7 @@ var AlternateCS = (function AlternateCSClosure() {
getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count,
dest, destOffset, bits, dest, destOffset, bits,
alpha01) { alpha01) {
var tinted;
var tintFn = this.tintFn; var tintFn = this.tintFn;
var base = this.base; var base = this.base;
var scale = 1 / ((1 << bits) - 1); var scale = 1 / ((1 << bits) - 1);
@ -1954,16 +1955,22 @@ var AlternateCS = (function AlternateCSClosure() {
var scaled = new Float32Array(numComps); var scaled = new Float32Array(numComps);
var i, j; var i, j;
for (i = 0; i < count; i++) { if (usesZeroToOneRange) {
for (j = 0; j < numComps; j++) { for (i = 0; i < count; i++) {
scaled[j] = src[srcOffset++] * scale; for (j = 0; j < numComps; j++) {
} scaled[j] = src[srcOffset++] * scale;
var tinted = tintFn(scaled); }
if (usesZeroToOneRange) { tinted = tintFn(scaled);
for (j = 0; j < baseNumComps; j++) { for (j = 0; j < baseNumComps; j++) {
baseBuf[pos++] = tinted[j] * 255; baseBuf[pos++] = tinted[j] * 255;
} }
} else { }
} else {
for (i = 0; i < count; i++) {
for (j = 0; j < numComps; j++) {
scaled[j] = src[srcOffset++] * scale;
}
tinted = tintFn(scaled);
base.getRgbItem(tinted, 0, baseBuf, pos); base.getRgbItem(tinted, 0, baseBuf, pos);
pos += baseNumComps; pos += baseNumComps;
} }
@ -2843,66 +2850,57 @@ var PDFFunction = (function PDFFunctionClosure() {
var domain = IR[1]; var domain = IR[1];
var range = IR[2]; var range = IR[2];
var code = IR[3]; var code = IR[3];
var numOutputs = range.length / 2; var numOutputs = range.length >> 1;
var numInputs = domain.length >> 1;
var evaluator = new PostScriptEvaluator(code); var evaluator = new PostScriptEvaluator(code);
// Cache the values for a big speed up, the cache size is limited though // Cache the values for a big speed up, the cache size is limited though
// since the number of possible values can be huge from a PS function. // since the number of possible values can be huge from a PS function.
var cache = new FunctionCache(); var cache = {};
// The MAX_CACHE_SIZE is set to ~4x the maximum number of distinct values
// seen in our tests.
var MAX_CACHE_SIZE = 2048 * 4;
var cache_available = MAX_CACHE_SIZE;
return function constructPostScriptFromIRResult(args) { return function constructPostScriptFromIRResult(args) {
var initialStack = []; var i, value;
for (var i = 0, ii = (domain.length / 2); i < ii; ++i) { var key = '';
initialStack.push(args[i]); var input = new Array(numInputs);
} for (i = 0; i < numInputs; i++) {
value = args[i];
var key = initialStack.join('_'); input[i] = value;
if (cache.has(key)) { key += value + '_';
return cache.get(key); }
}
var cachedValue = cache[key];
var stack = evaluator.execute(initialStack); if (cachedValue !== undefined) {
var transformed = []; return cachedValue;
for (i = numOutputs - 1; i >= 0; --i) { }
var out = stack.pop();
var rangeIndex = 2 * i; var output = new Array(numOutputs);
if (out < range[rangeIndex]) { var stack = evaluator.execute(input);
out = range[rangeIndex]; var stackIndex = stack.length - numOutputs;
} else if (out > range[rangeIndex + 1]) { for (i = 0; i < numOutputs; i++) {
out = range[rangeIndex + 1]; value = stack[stackIndex + i];
var bound = range[i * 2];
if (value < bound) {
value = bound;
} else {
bound = range[i * 2 +1];
if (value > bound) {
value = bound;
}
} }
transformed[i] = out; output[i] = value;
}
if (cache_available > 0) {
cache_available--;
cache[key] = output;
} }
cache.set(key, transformed); return output;
return transformed;
}; };
} }
}; };
})(); })();
var FunctionCache = (function FunctionCacheClosure() {
// Of 10 PDF's with type4 functions the maxium number of distinct values seen
// was 256. This still may need some tweaking in the future though.
var MAX_CACHE_SIZE = 1024;
function FunctionCache() {
this.cache = {};
this.total = 0;
}
FunctionCache.prototype = {
has: function FunctionCache_has(key) {
return key in this.cache;
},
get: function FunctionCache_get(key) {
return this.cache[key];
},
set: function FunctionCache_set(key, value) {
if (this.total < MAX_CACHE_SIZE) {
this.cache[key] = value;
this.total++;
}
}
};
return FunctionCache;
})();
var PostScriptStack = (function PostScriptStackClosure() { var PostScriptStack = (function PostScriptStackClosure() {
var MAX_STACK_SIZE = 100; var MAX_STACK_SIZE = 100;
function PostScriptStack(initialStack) { function PostScriptStack(initialStack) {
@ -39746,8 +39744,8 @@ var DecodeStream = (function DecodeStreamClosure() {
size *= 2; size *= 2;
} }
var buffer2 = new Uint8Array(size); var buffer2 = new Uint8Array(size);
for (var i = 0; i < current; ++i) { if (buffer) {
buffer2[i] = buffer[i]; buffer2.set(buffer);
} }
return (this.buffer = buffer2); return (this.buffer = buffer2);
}, },

106
build/pdf.js

@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.0.209'; PDFJS.version = '1.0.213';
PDFJS.build = '0d8e3cc'; PDFJS.build = '7f6cb0e';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
@ -1941,6 +1941,7 @@ var AlternateCS = (function AlternateCSClosure() {
getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count,
dest, destOffset, bits, dest, destOffset, bits,
alpha01) { alpha01) {
var tinted;
var tintFn = this.tintFn; var tintFn = this.tintFn;
var base = this.base; var base = this.base;
var scale = 1 / ((1 << bits) - 1); var scale = 1 / ((1 << bits) - 1);
@ -1954,16 +1955,22 @@ var AlternateCS = (function AlternateCSClosure() {
var scaled = new Float32Array(numComps); var scaled = new Float32Array(numComps);
var i, j; var i, j;
for (i = 0; i < count; i++) { if (usesZeroToOneRange) {
for (j = 0; j < numComps; j++) { for (i = 0; i < count; i++) {
scaled[j] = src[srcOffset++] * scale; for (j = 0; j < numComps; j++) {
} scaled[j] = src[srcOffset++] * scale;
var tinted = tintFn(scaled); }
if (usesZeroToOneRange) { tinted = tintFn(scaled);
for (j = 0; j < baseNumComps; j++) { for (j = 0; j < baseNumComps; j++) {
baseBuf[pos++] = tinted[j] * 255; baseBuf[pos++] = tinted[j] * 255;
} }
} else { }
} else {
for (i = 0; i < count; i++) {
for (j = 0; j < numComps; j++) {
scaled[j] = src[srcOffset++] * scale;
}
tinted = tintFn(scaled);
base.getRgbItem(tinted, 0, baseBuf, pos); base.getRgbItem(tinted, 0, baseBuf, pos);
pos += baseNumComps; pos += baseNumComps;
} }
@ -2843,66 +2850,57 @@ var PDFFunction = (function PDFFunctionClosure() {
var domain = IR[1]; var domain = IR[1];
var range = IR[2]; var range = IR[2];
var code = IR[3]; var code = IR[3];
var numOutputs = range.length / 2; var numOutputs = range.length >> 1;
var numInputs = domain.length >> 1;
var evaluator = new PostScriptEvaluator(code); var evaluator = new PostScriptEvaluator(code);
// Cache the values for a big speed up, the cache size is limited though // Cache the values for a big speed up, the cache size is limited though
// since the number of possible values can be huge from a PS function. // since the number of possible values can be huge from a PS function.
var cache = new FunctionCache(); var cache = {};
// The MAX_CACHE_SIZE is set to ~4x the maximum number of distinct values
// seen in our tests.
var MAX_CACHE_SIZE = 2048 * 4;
var cache_available = MAX_CACHE_SIZE;
return function constructPostScriptFromIRResult(args) { return function constructPostScriptFromIRResult(args) {
var initialStack = []; var i, value;
for (var i = 0, ii = (domain.length / 2); i < ii; ++i) { var key = '';
initialStack.push(args[i]); var input = new Array(numInputs);
for (i = 0; i < numInputs; i++) {
value = args[i];
input[i] = value;
key += value + '_';
} }
var key = initialStack.join('_'); var cachedValue = cache[key];
if (cache.has(key)) { if (cachedValue !== undefined) {
return cache.get(key); return cachedValue;
} }
var stack = evaluator.execute(initialStack); var output = new Array(numOutputs);
var transformed = []; var stack = evaluator.execute(input);
for (i = numOutputs - 1; i >= 0; --i) { var stackIndex = stack.length - numOutputs;
var out = stack.pop(); for (i = 0; i < numOutputs; i++) {
var rangeIndex = 2 * i; value = stack[stackIndex + i];
if (out < range[rangeIndex]) { var bound = range[i * 2];
out = range[rangeIndex]; if (value < bound) {
} else if (out > range[rangeIndex + 1]) { value = bound;
out = range[rangeIndex + 1]; } else {
bound = range[i * 2 +1];
if (value > bound) {
value = bound;
}
} }
transformed[i] = out; output[i] = value;
}
if (cache_available > 0) {
cache_available--;
cache[key] = output;
} }
cache.set(key, transformed); return output;
return transformed;
}; };
} }
}; };
})(); })();
var FunctionCache = (function FunctionCacheClosure() {
// Of 10 PDF's with type4 functions the maxium number of distinct values seen
// was 256. This still may need some tweaking in the future though.
var MAX_CACHE_SIZE = 1024;
function FunctionCache() {
this.cache = {};
this.total = 0;
}
FunctionCache.prototype = {
has: function FunctionCache_has(key) {
return key in this.cache;
},
get: function FunctionCache_get(key) {
return this.cache[key];
},
set: function FunctionCache_set(key, value) {
if (this.total < MAX_CACHE_SIZE) {
this.cache[key] = value;
this.total++;
}
}
};
return FunctionCache;
})();
var PostScriptStack = (function PostScriptStackClosure() { var PostScriptStack = (function PostScriptStackClosure() {
var MAX_STACK_SIZE = 100; var MAX_STACK_SIZE = 100;
function PostScriptStack(initialStack) { function PostScriptStack(initialStack) {

118
build/pdf.worker.js vendored

@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.0.209'; PDFJS.version = '1.0.213';
PDFJS.build = '0d8e3cc'; PDFJS.build = '7f6cb0e';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
@ -1941,6 +1941,7 @@ var AlternateCS = (function AlternateCSClosure() {
getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count,
dest, destOffset, bits, dest, destOffset, bits,
alpha01) { alpha01) {
var tinted;
var tintFn = this.tintFn; var tintFn = this.tintFn;
var base = this.base; var base = this.base;
var scale = 1 / ((1 << bits) - 1); var scale = 1 / ((1 << bits) - 1);
@ -1954,16 +1955,22 @@ var AlternateCS = (function AlternateCSClosure() {
var scaled = new Float32Array(numComps); var scaled = new Float32Array(numComps);
var i, j; var i, j;
for (i = 0; i < count; i++) { if (usesZeroToOneRange) {
for (j = 0; j < numComps; j++) { for (i = 0; i < count; i++) {
scaled[j] = src[srcOffset++] * scale; for (j = 0; j < numComps; j++) {
} scaled[j] = src[srcOffset++] * scale;
var tinted = tintFn(scaled); }
if (usesZeroToOneRange) { tinted = tintFn(scaled);
for (j = 0; j < baseNumComps; j++) { for (j = 0; j < baseNumComps; j++) {
baseBuf[pos++] = tinted[j] * 255; baseBuf[pos++] = tinted[j] * 255;
} }
} else { }
} else {
for (i = 0; i < count; i++) {
for (j = 0; j < numComps; j++) {
scaled[j] = src[srcOffset++] * scale;
}
tinted = tintFn(scaled);
base.getRgbItem(tinted, 0, baseBuf, pos); base.getRgbItem(tinted, 0, baseBuf, pos);
pos += baseNumComps; pos += baseNumComps;
} }
@ -2843,66 +2850,57 @@ var PDFFunction = (function PDFFunctionClosure() {
var domain = IR[1]; var domain = IR[1];
var range = IR[2]; var range = IR[2];
var code = IR[3]; var code = IR[3];
var numOutputs = range.length / 2; var numOutputs = range.length >> 1;
var numInputs = domain.length >> 1;
var evaluator = new PostScriptEvaluator(code); var evaluator = new PostScriptEvaluator(code);
// Cache the values for a big speed up, the cache size is limited though // Cache the values for a big speed up, the cache size is limited though
// since the number of possible values can be huge from a PS function. // since the number of possible values can be huge from a PS function.
var cache = new FunctionCache(); var cache = {};
// The MAX_CACHE_SIZE is set to ~4x the maximum number of distinct values
// seen in our tests.
var MAX_CACHE_SIZE = 2048 * 4;
var cache_available = MAX_CACHE_SIZE;
return function constructPostScriptFromIRResult(args) { return function constructPostScriptFromIRResult(args) {
var initialStack = []; var i, value;
for (var i = 0, ii = (domain.length / 2); i < ii; ++i) { var key = '';
initialStack.push(args[i]); var input = new Array(numInputs);
} for (i = 0; i < numInputs; i++) {
value = args[i];
var key = initialStack.join('_'); input[i] = value;
if (cache.has(key)) { key += value + '_';
return cache.get(key); }
}
var cachedValue = cache[key];
var stack = evaluator.execute(initialStack); if (cachedValue !== undefined) {
var transformed = []; return cachedValue;
for (i = numOutputs - 1; i >= 0; --i) { }
var out = stack.pop();
var rangeIndex = 2 * i; var output = new Array(numOutputs);
if (out < range[rangeIndex]) { var stack = evaluator.execute(input);
out = range[rangeIndex]; var stackIndex = stack.length - numOutputs;
} else if (out > range[rangeIndex + 1]) { for (i = 0; i < numOutputs; i++) {
out = range[rangeIndex + 1]; value = stack[stackIndex + i];
var bound = range[i * 2];
if (value < bound) {
value = bound;
} else {
bound = range[i * 2 +1];
if (value > bound) {
value = bound;
}
} }
transformed[i] = out; output[i] = value;
}
if (cache_available > 0) {
cache_available--;
cache[key] = output;
} }
cache.set(key, transformed); return output;
return transformed;
}; };
} }
}; };
})(); })();
var FunctionCache = (function FunctionCacheClosure() {
// Of 10 PDF's with type4 functions the maxium number of distinct values seen
// was 256. This still may need some tweaking in the future though.
var MAX_CACHE_SIZE = 1024;
function FunctionCache() {
this.cache = {};
this.total = 0;
}
FunctionCache.prototype = {
has: function FunctionCache_has(key) {
return key in this.cache;
},
get: function FunctionCache_get(key) {
return this.cache[key];
},
set: function FunctionCache_set(key, value) {
if (this.total < MAX_CACHE_SIZE) {
this.cache[key] = value;
this.total++;
}
}
};
return FunctionCache;
})();
var PostScriptStack = (function PostScriptStackClosure() { var PostScriptStack = (function PostScriptStackClosure() {
var MAX_STACK_SIZE = 100; var MAX_STACK_SIZE = 100;
function PostScriptStack(initialStack) { function PostScriptStack(initialStack) {
@ -35153,8 +35151,8 @@ var DecodeStream = (function DecodeStreamClosure() {
size *= 2; size *= 2;
} }
var buffer2 = new Uint8Array(size); var buffer2 = new Uint8Array(size);
for (var i = 0; i < current; ++i) { if (buffer) {
buffer2[i] = buffer[i]; buffer2.set(buffer);
} }
return (this.buffer = buffer2); return (this.buffer = buffer2);
}, },

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.0.209", "version": "1.0.213",
"description": "Generic build of Mozilla's PDF.js library.", "description": "Generic build of Mozilla's PDF.js library.",
"keywords": [ "keywords": [
"Mozilla", "Mozilla",

Loading…
Cancel
Save