Skip to content

Commit

Permalink
Merge pull request #15574 from calixteman/bug1795263
Browse files Browse the repository at this point in the history
Use all the current transform as key when caching some image for masks used with pattern fill (bug 1795263, #15573)
  • Loading branch information
Snuffleupagus authored Oct 14, 2022
2 parents 15d4d80 + 556513a commit 9f5fd07
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/display/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -1368,11 +1368,12 @@ class CanvasGraphics {
// In case we've a pattern fill we just keep the scaled version of
// the image.
// Only the scaling part matters, the translation part is just used
// to compute offsets.
// to compute offsets (but not when filling patterns see #15573).
// TODO: handle the case of a pattern fill if it's possible.
const withoutTranslation = currentTransform.slice(0, 4);
cacheKey = JSON.stringify(
isPatternFill ? withoutTranslation : [withoutTranslation, fillColor]
isPatternFill
? currentTransform
: [currentTransform.slice(0, 4), fillColor]
);

cache = this._cachedBitmapsMap.get(mainKey);
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -544,3 +544,4 @@
!tracemonkey_a11y.pdf
!bug1782564.pdf
!issue15340.pdf
!bug1795263.pdf
Binary file added test/pdfs/bug1795263.pdf
Binary file not shown.
6 changes: 6 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6926,5 +6926,11 @@
"link": true,
"rounds": 1,
"type": "eq"
},
{ "id": "bug1795263",
"file": "pdfs/bug1795263.pdf",
"md5": "af708acbb22c6c9d268240dcf4a39809",
"rounds": 1,
"type": "eq"
}
]

0 comments on commit 9f5fd07

Please sign in to comment.