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

Partial fix for issue #68: Managing GraphicsState with a Stack is unsafe #69

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

davideby
Copy link
Contributor

@davideby davideby commented Jun 8, 2018

This is a partial fix. The idea here is similar to what was discussed in that Issue thread. We associate every Command with a "parent" CreateCommand linking to the VectorGraphics2D in which that command was emitted. Then, during rendering we can link to a clean GraphicsState to track the modifications made by those Commands only so rendering "within" each CreateCommand can happen independently.

Arguably it would be better for every Command to accept its parent via a constructor arg, but that would have made this PR big and unwieldy and harder to review. So this was kind of a way to introduce the concept in a more controlled way since it affects fewer call sites.

Also, this only fixes SVG and PDF but not EPS as that doesn't use the Stack concept directly. I'm not quite sure how to fix this for EPS, so hopefully someone else can pick it up from there.

Unfortunately, we're still seeing further bugs and their cause is not clear. Our project team has decided to stick with Batik after all since their latest release works with Java 9+ so I can't pursue this any more for now. It was really close but we just didn't have the resources to go further.

We may have to pick this up again for a different project, though, so I may be back with more fixes.

Thanks, hope this helps!

davideby added 3 commits June 8, 2018 08:59
This is SVG-only and the structure is a little messy.  Needs some
clean-up before extending to PDF & EPS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant