-
Couldn't load subscription status.
- Fork 3.3k
Reland "LibPDF: Add basic tiled, coloured pattern rendering" #26295
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
Conversation
|
I think that we usually modify the original commits themselves, rather than relanding and adding a fixup commit. |
|
Thanks for the PR! Happy to merge this (but I agree with @LucasChollet's comment – having HEAD working at all comments is nice in that it makes bisecting easier, etc. It was useful to see what changed, but github makes you choose either a clean history or nice diffs between PR revisions, and serenity chooses the former.) However, I kind of feel like maybe painting patterns to bitmaps and tiling those might be a better approach than the current approach. That'd be more how other features work, is probably easier to get fast (once we get to that step), interacts nicer with clip masks, type 2 patterns, etc. (But it's fine to merge the current approach, it's still a step forward.) Given we have That's a pretty big number of "Malformed PDF"; maybe the code isn't quite right yet. (This isn't a regression, so figuring this out isn't a blocker for merging this, and most of it needs investigating independent of the pattern rendering approach.) Also, the one real-life example of these patterns that I've consciously seen doesn't seem to improve much with this PR: |
|
I don't think this implementation is really correct. I'm guessing just enough was implemented to get My thinking was just to reland the initial patches (fixing up the crashes) and use that as a starting point, as they're at least somewhat along the right lines. |
|
(Just to reiterate: Sounds great, but please amend the third commit into the first two :)) |
This reverts commit 6032c06. This relands the original commit with fixups to make `PatternColorSpace` more robust to unexpected inputs. While working on SerenityOS#26292, I noticed that while fills/strokes can be Gfx::PaintStyles in LibPDF, currently they never are, which confused me. It turns out that a few years ago, tiled patterns were implemented in PR SerenityOS#22197, but were partially reverted due to crashes in SerenityOS#22364, leaving around a partial implementation. It appears the author was going to look into the crashes, but never got around to it. So, this patch resolves all the crashes on `0000.zip`, mainly by checking types and not assuming dictionary keys exist. Summary of `./Meta/test_pdf.py ~/Downloads/0000`: ``` Stacks: 0 crashes (0.0%) 0 distinct crash stacks 7 failed to open (0.7%) /home/macdue/Downloads/0000/0000346.pdf /home/macdue/Downloads/0000/0000202.pdf /home/macdue/Downloads/0000/0000399.pdf /home/macdue/Downloads/0000/0000421.pdf /home/macdue/Downloads/0000/0000480.pdf /home/macdue/Downloads/0000/0000920.pdf /home/macdue/Downloads/0000/0000819.pdf 3 files with password (0.3%) 909 files without issues (90.9%) ``` Co-authored-by: MacDue <[email protected]>
This reverts commit 7cb216c.
1a7bca7 to
4579350
Compare
|
Done 👍 I've squashed the fixups into the first commit (as I don't think there are any crashes directly caused by the second commit). |


While working on #26292, I noticed that while fills/strokes can be
Gfx::PaintStylesin LibPDF, currently they never are, which confused me.It turns out that a few years ago, tiled patterns were implemented in PR #22197, but were partially reverted due to crashes in #22364, leaving around a partial implementation.
It appears the author was going to look into the crashes, but never got around to it. So, this patch resolves all the crashes on
0000.zip, mainly by checking types and not assuming dictionary keys exist.Summary of
./Meta/test_pdf.py ~/Downloads/0000: