Skip to content

Commit

Permalink
Merge pull request mozilla#18895 from calixteman/issue18894
Browse files Browse the repository at this point in the history
Fallback on gray colorspace when there are no colorspace and no name in the scn/SCN arguments
  • Loading branch information
calixteman authored Oct 13, 2024
2 parents 1c0c070 + e7ab8cd commit e1f9fa4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2079,6 +2079,11 @@ class PartialEvaluator {
case OPS.setFillColorN:
cs = stateManager.state.patternFillColorSpace;
if (!cs) {
if (isNumberArray(args, null)) {
args = ColorSpace.singletons.gray.getRgb(args, 0);
fn = OPS.setFillRGBColor;
break;
}
args = [];
fn = OPS.setFillTransparent;
break;
Expand Down Expand Up @@ -2106,6 +2111,11 @@ class PartialEvaluator {
case OPS.setStrokeColorN:
cs = stateManager.state.patternStrokeColorSpace;
if (!cs) {
if (isNumberArray(args, null)) {
args = ColorSpace.singletons.gray.getRgb(args, 0);
fn = OPS.setStrokeRGBColor;
break;
}
args = [];
fn = OPS.setStrokeTransparent;
break;
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -675,3 +675,4 @@
!stamps.pdf
!issue15096.pdf
!issue18036.pdf
!issue18894.pdf
Binary file added test/pdfs/issue18894.pdf
Binary file not shown.
8 changes: 8 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10692,5 +10692,13 @@
"rounds": 1,
"type": "eq",
"annotations": true
},
{
"id": "issue18894",
"file": "pdfs/issue18894.pdf",
"md5": "5cd744bf8c0800e93c22ed92d1c162f4",
"rounds": 1,
"type": "eq",
"talos": false
}
]

0 comments on commit e1f9fa4

Please sign in to comment.