1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #2313 from yurydelendik/issue-1905

Fixes incomplete restore in paintFormXObject
This commit is contained in:
Yury Delendik 2012-10-29 12:09:11 -07:00
commit 1f084053e6
4 changed files with 15 additions and 1 deletions

View file

@ -187,6 +187,7 @@ var CanvasExtraState = (function CanvasExtraStateClosure() {
this.fillAlpha = 1;
this.strokeAlpha = 1;
this.lineWidth = 1;
this.paintFormXObjectDepth = 0;
this.old = old;
}
@ -1109,6 +1110,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix,
bbox) {
this.save();
this.current.paintFormXObjectDepth++;
if (matrix && isArray(matrix) && 6 == matrix.length)
this.transform.apply(this, matrix);
@ -1123,7 +1125,12 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
},
paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() {
this.restore();
var depth = this.current.paintFormXObjectDepth;
do {
this.restore();
// some pdf don't close all restores inside object
// closing those for them
} while (this.current.paintFormXObjectDepth >= depth);
},
paintJpegXObject: function CanvasGraphics_paintJpegXObject(objId, w, h) {