|
|
@ -860,7 +860,7 @@ var PredictorStream = (function() { |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
var JpegStreamIR = (function() { |
|
|
|
var JpegStreamIR = (function() { |
|
|
|
function JpegStreamIR(objId, IR) { |
|
|
|
function JpegStreamIR(objId, IR, objs) { |
|
|
|
var src = 'data:image/jpeg;base64,' + window.btoa(IR); |
|
|
|
var src = 'data:image/jpeg;base64,' + window.btoa(IR); |
|
|
|
|
|
|
|
|
|
|
|
// create DOM image
|
|
|
|
// create DOM image
|
|
|
@ -868,7 +868,7 @@ var JpegStreamIR = (function() { |
|
|
|
img.onload = (function() { |
|
|
|
img.onload = (function() { |
|
|
|
this.loaded = true; |
|
|
|
this.loaded = true; |
|
|
|
|
|
|
|
|
|
|
|
Objects.resolve(objId, this); |
|
|
|
objs.resolve(objId, this); |
|
|
|
|
|
|
|
|
|
|
|
if (this.onLoad) |
|
|
|
if (this.onLoad) |
|
|
|
this.onLoad(); |
|
|
|
this.onLoad(); |
|
|
@ -3392,7 +3392,7 @@ var Page = (function() { |
|
|
|
for (var i = 0; i < fonts.length; i++) { |
|
|
|
for (var i = 0; i < fonts.length; i++) { |
|
|
|
// HACK FOR NOW. Access the data directly. This isn't allowed as the
|
|
|
|
// HACK FOR NOW. Access the data directly. This isn't allowed as the
|
|
|
|
// font object isn't resolved yet.
|
|
|
|
// font object isn't resolved yet.
|
|
|
|
fonts[i] = Objects.objs[fonts[i]].data; |
|
|
|
fonts[i] = this.objs.objs[fonts[i]].data; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Load all the fonts
|
|
|
|
// Load all the fonts
|
|
|
@ -3402,7 +3402,8 @@ var Page = (function() { |
|
|
|
this.stats.fonts = Date.now(); |
|
|
|
this.stats.fonts = Date.now(); |
|
|
|
|
|
|
|
|
|
|
|
callback.call(this); |
|
|
|
callback.call(this); |
|
|
|
}.bind(this) |
|
|
|
}.bind(this), |
|
|
|
|
|
|
|
this.objs |
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -4852,14 +4853,15 @@ var CanvasGraphics = (function() { |
|
|
|
// if we execute longer then `kExecutionTime`.
|
|
|
|
// if we execute longer then `kExecutionTime`.
|
|
|
|
var kExecutionTimeCheck = 500; |
|
|
|
var kExecutionTimeCheck = 500; |
|
|
|
|
|
|
|
|
|
|
|
function constructor(canvasCtx, imageCanvas) { |
|
|
|
function constructor(canvasCtx, objs) { |
|
|
|
this.ctx = canvasCtx; |
|
|
|
this.ctx = canvasCtx; |
|
|
|
this.current = new CanvasExtraState(); |
|
|
|
this.current = new CanvasExtraState(); |
|
|
|
this.stateStack = []; |
|
|
|
this.stateStack = []; |
|
|
|
this.pendingClip = null; |
|
|
|
this.pendingClip = null; |
|
|
|
this.res = null; |
|
|
|
this.res = null; |
|
|
|
this.xobjs = null; |
|
|
|
this.xobjs = null; |
|
|
|
this.ScratchCanvas = imageCanvas || ScratchCanvas; |
|
|
|
this.ScratchCanvas = ScratchCanvas; |
|
|
|
|
|
|
|
this.objs = objs; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var LINE_CAP_STYLES = ['butt', 'round', 'square']; |
|
|
|
var LINE_CAP_STYLES = ['butt', 'round', 'square']; |
|
|
@ -4897,6 +4899,8 @@ var CanvasGraphics = (function() { |
|
|
|
var executionEndIdx; |
|
|
|
var executionEndIdx; |
|
|
|
var startTime = Date.now(); |
|
|
|
var startTime = Date.now(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var objs = this.objs; |
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
|
do { |
|
|
|
executionEndIdx = Math.min(argsArrayLen, i + kExecutionTimeCheck); |
|
|
|
executionEndIdx = Math.min(argsArrayLen, i + kExecutionTimeCheck); |
|
|
|
|
|
|
|
|
|
|
@ -4910,8 +4914,8 @@ var CanvasGraphics = (function() { |
|
|
|
|
|
|
|
|
|
|
|
// If the promise isn't resolved yet, add the continueCallback
|
|
|
|
// If the promise isn't resolved yet, add the continueCallback
|
|
|
|
// to the promise and bail out.
|
|
|
|
// to the promise and bail out.
|
|
|
|
if (!Objects.isResolved(depObjId)) { |
|
|
|
if (!objs.isResolved(depObjId)) { |
|
|
|
Objects.get(depObjId, continueCallback); |
|
|
|
objs.get(depObjId, continueCallback); |
|
|
|
return i; |
|
|
|
return i; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -5133,7 +5137,7 @@ var CanvasGraphics = (function() { |
|
|
|
setFont: function(fontRef, size) { |
|
|
|
setFont: function(fontRef, size) { |
|
|
|
// Lookup the fontObj using fontRef only.
|
|
|
|
// Lookup the fontObj using fontRef only.
|
|
|
|
var fontRefName = fontRef.name; |
|
|
|
var fontRefName = fontRef.name; |
|
|
|
var fontObj = Objects.get(fontRefName); |
|
|
|
var fontObj = this.objs.get(fontRefName); |
|
|
|
|
|
|
|
|
|
|
|
if (!fontObj) { |
|
|
|
if (!fontObj) { |
|
|
|
throw "Can't find font for " + fontRefName; |
|
|
|
throw "Can't find font for " + fontRefName; |
|
|
@ -5314,7 +5318,7 @@ var CanvasGraphics = (function() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Build the pattern based on the IR data.
|
|
|
|
// Build the pattern based on the IR data.
|
|
|
|
var pattern = new TilingPatternIR(IR, color, this.ctx); |
|
|
|
var pattern = new TilingPatternIR(IR, color, this.ctx, this.objs); |
|
|
|
} else if (IR[0] == "RadialAxialShading" || IR[0] == "DummyShading") { |
|
|
|
} else if (IR[0] == "RadialAxialShading" || IR[0] == "DummyShading") { |
|
|
|
var pattern = Pattern.shadingFromIR(this.ctx, IR); |
|
|
|
var pattern = Pattern.shadingFromIR(this.ctx, IR); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -5434,7 +5438,7 @@ var CanvasGraphics = (function() { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
paintJpegXObject: function(objId, w, h) { |
|
|
|
paintJpegXObject: function(objId, w, h) { |
|
|
|
var image = Objects.get(objId); |
|
|
|
var image = this.objs.get(objId); |
|
|
|
if (!image) { |
|
|
|
if (!image) { |
|
|
|
error("Dependent image isn't ready yet"); |
|
|
|
error("Dependent image isn't ready yet"); |
|
|
|
} |
|
|
|
} |
|
|
@ -6185,7 +6189,7 @@ var RadialAxialShading = (function() { |
|
|
|
var TilingPatternIR = (function() { |
|
|
|
var TilingPatternIR = (function() { |
|
|
|
var PAINT_TYPE_COLORED = 1, PAINT_TYPE_UNCOLORED = 2; |
|
|
|
var PAINT_TYPE_COLORED = 1, PAINT_TYPE_UNCOLORED = 2; |
|
|
|
|
|
|
|
|
|
|
|
function TilingPatternIR(IR, color, ctx) { |
|
|
|
function TilingPatternIR(IR, color, ctx, objs) { |
|
|
|
// "Unfolding" the IR.
|
|
|
|
// "Unfolding" the IR.
|
|
|
|
var IRQueue = IR[2]; |
|
|
|
var IRQueue = IR[2]; |
|
|
|
this.matrix = IR[3]; |
|
|
|
this.matrix = IR[3]; |
|
|
@ -6223,7 +6227,7 @@ var TilingPatternIR = (function() { |
|
|
|
|
|
|
|
|
|
|
|
// set the new canvas element context as the graphics context
|
|
|
|
// set the new canvas element context as the graphics context
|
|
|
|
var tmpCtx = tmpCanvas.getContext('2d'); |
|
|
|
var tmpCtx = tmpCanvas.getContext('2d'); |
|
|
|
var graphics = new CanvasGraphics(tmpCtx); |
|
|
|
var graphics = new CanvasGraphics(tmpCtx, objs); |
|
|
|
|
|
|
|
|
|
|
|
switch (paintType) { |
|
|
|
switch (paintType) { |
|
|
|
case PAINT_TYPE_COLORED: |
|
|
|
case PAINT_TYPE_COLORED: |
|
|
|