Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix color of image masks inside uncolored patterns #8808

Merged
merged 1 commit into from
Sep 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/display/pattern_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ var TilingPattern = (function TilingPatternClosure() {
var graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx);
graphics.groupLevel = owner.groupLevel;

this.setFillAndStrokeStyleToContext(tmpCtx, paintType, color);
this.setFillAndStrokeStyleToContext(graphics, paintType, color);

this.setScale(width, height, xstep, ystep);
this.transformToScale(graphics);
Expand Down Expand Up @@ -401,17 +401,23 @@ var TilingPattern = (function TilingPatternClosure() {
},

setFillAndStrokeStyleToContext:
function setFillAndStrokeStyleToContext(context, paintType, color) {
function setFillAndStrokeStyleToContext(graphics, paintType, color) {
let context = graphics.ctx, current = graphics.current;
switch (paintType) {
case PaintType.COLORED:
var ctx = this.ctx;
context.fillStyle = ctx.fillStyle;
context.strokeStyle = ctx.strokeStyle;
current.fillColor = ctx.fillStyle;
current.strokeColor = ctx.strokeStyle;
break;
case PaintType.UNCOLORED:
var cssColor = Util.makeCssRgb(color[0], color[1], color[2]);
context.fillStyle = cssColor;
context.strokeStyle = cssColor;
// Set color needed by image masks (fixes issues 3226 and 8741).
current.fillColor = cssColor;
current.strokeColor = cssColor;
break;
default:
throw new FormatError(`Unsupported paint type: ${paintType}`);
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/pr8808.pdf.link
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
http://soap.plansystem.dk/pdfarchive/20_1057347_APPROVED_1193694109382.pdf
8 changes: 8 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,14 @@
"lastPage": 1,
"type": "load"
},
{ "id": "pr8808",
"file": "pdfs/pr8808.pdf",
"md5": "bdac6051a98fd8dcfc5344b05fed06f4",
"rounds": 1,
"link": true,
"lastPage": 1,
"type": "eq"
},
{ "id": "issue5599",
"file": "pdfs/issue5599.pdf",
"md5": "529a4a9409ac024aeb57a047210280fe",
Expand Down