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 context paint on shape with zero-size bbox #725

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

LaurenzV
Copy link
Contributor

Consider the following SVG:

<svg id="svg1" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
    <title>`context-stroke` on shape with zero-size bbox</title>

    <marker id="marker1" refX="10" refY="10" markerWidth="20" markerHeight="20">
        <path id="path-marker" d="M 10 0 16 20 H 4 Z" fill="context-stroke"/>
    </marker>
    <path id="path1" stroke="green" d="M 100 25 L 100 175"
          marker-end="url(#marker1)"/>
    <!-- image frame -->
    <rect id="frame" x="1" y="1" width="198" height="198" fill="none" stroke="black"/>
</svg>

Currently, it renders like this:
test

The reason being that in my previous implementation, I wrongly assumed that we always need to have a bbox for context-fill/context-stroke, which is not true for solid paints. Since a line doesn't have a bbox, this example would fail to render correctly previously. This PR fixes this:
test

@RazrFalcon RazrFalcon merged commit 5b97397 into RazrFalcon:master Mar 19, 2024
3 checks passed
@RazrFalcon
Copy link
Owner

Thanks. Zero width/height bbox are tricky to handle in SVG.

@LaurenzV LaurenzV deleted the bbox-fix branch March 20, 2024 11:28
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.

None yet

2 participants