1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Merge pull request #10851 from brendandahl/shading-bbox

Apply bounding box before using shading patterns.
This commit is contained in:
Tim van der Meij 2019-07-12 22:52:07 +02:00 committed by GitHub
commit ed3954fc7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 191 additions and 8 deletions

View file

@ -96,6 +96,12 @@ Shadings.RadialAxial = (function RadialAxialClosure() {
var cs = dict.get('ColorSpace', 'CS');
cs = ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
this.cs = cs;
const bbox = dict.getArray('BBox');
if (Array.isArray(bbox) && bbox.length === 4) {
this.bbox = Util.normalizeRect(bbox);
} else {
this.bbox = null;
}
var t0 = 0.0, t1 = 1.0;
if (dict.has('Domain')) {
@ -213,7 +219,7 @@ Shadings.RadialAxial = (function RadialAxialClosure() {
}
}
return ['RadialAxial', type, this.colorStops, p0, p1, r0, r1];
return ['RadialAxial', type, this.bbox, this.colorStops, p0, p1, r0, r1];
},
};
@ -719,7 +725,12 @@ Shadings.Mesh = (function MeshClosure() {
this.matrix = matrix;
this.shadingType = dict.get('ShadingType');
this.type = 'Pattern';
this.bbox = dict.getArray('BBox');
const bbox = dict.getArray('BBox');
if (Array.isArray(bbox) && bbox.length === 4) {
this.bbox = Util.normalizeRect(bbox);
} else {
this.bbox = null;
}
var cs = dict.get('ColorSpace', 'CS');
cs = ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
this.cs = cs;