Fix SIMD OverwriteBlend clearing pixels the path does not cover - #593
Merged
Merged
Conversation
Owner
|
Thanks for this fix! The SIMD changes fixed the uncovered-pixel artifacts in my tests. I found one regression in the scalar guard: checking I've added a small follow-up commit that checks quantized path coverage independently of paint alpha. It keeps your SIMD changes and existing tests, and adds two regression checks:
The tests fail on master for the original SIMD bug, fail on the previous PR version for the clearing regression, and pass with the update. Local C, C++, SSE2-only, and non-SIMD checks pass; CI is next. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FYI
Summary
blendLineCoverageOverwriteis specified by its scalar body to write onlywhere coverage is non-zero:
The SSE2, AVX2 and NEON implementations do not honour that. Where coverage is
zero they write
rgbx * 0— transparent black — over the backdrop.The vectors this affects are the antialiased edges of the shape being drawn, so
an
OverwriteBlendfill or stroke erases whatever was already on the image, inbands the width of a SIMD vector, wherever it has an edge. Drawing a 40 point
star onto an opaque 400x300 image destroys 15234 pixels it does not cover.
Reproduction
Before
After
After scalar fix
he trapezoid partial-coverage loops in
fillShapeswroteblender(backdrop, source)unconditionally.sourceisrgbx * areafor acontinuous
area, so a thin enough sliver rounds it to fully transparent andOverwriteBlendstores that over the backdrop.fillCoveragecannot hit thisbecause its coverage is already quantised to 1/255.
The guard matches what
fillCoverage's general branch already does — skip zerocoverage for every mode except
MaskBlend, which has to clear:With both commits an
OverwriteBlendfill destroys no uncovered pixels at all,on any build.