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 rendering of web Rect with large corner radius #13649

Merged
merged 1 commit into from Jan 17, 2024

Conversation

ianthomas23
Copy link
Member

This fixes the rendering of WebGL Rect glyphs with large corner radii. Here is the Glyph_models__should_support_Rect_with_large_rounded_corners_that_need_scaling.png baseline test image before and after:

before

after

There isn't a simple Python reproducer until #13637 is fixed.

Code changes are all in the shaders. Previously we were only considering the distance to the nearest Rect corner so we only looked at the local x,y quadrant. This isn't sufficient and we have to look at all 4 corners to support large radii. This changes the logic of the fragment shader, necessarily making it more complicated. I have also moved the calculation to limit the corner radii to the vertex shader so that it only needs to be calculated 4 times (one per rect vertex) rather than once per pixel rendered, and written it in a more condensed and faster form.

Copy link

codecov bot commented Jan 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (59751d9) 92.56% compared to head (2633d11) 92.56%.

Additional details and impacted files
@@             Coverage Diff             @@
##           branch-3.4   #13649   +/-   ##
===========================================
  Coverage       92.56%   92.56%           
===========================================
  Files             323      323           
  Lines           20509    20509           
===========================================
  Hits            18985    18985           
  Misses           1524     1524           

@mattpap mattpap added this to the 3.4 milestone Jan 17, 2024
@ianthomas23 ianthomas23 merged commit 3df4d05 into branch-3.4 Jan 17, 2024
29 of 30 checks passed
@ianthomas23 ianthomas23 deleted the ianthomas23/13648_webgl_rect_large_corner branch January 17, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] WebGL Rect with large corner radius rendered incorrectly
2 participants