Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUse one iteration of Newton's method to approximate distance to an ellipse rather than computing the exact distance. #2423
Conversation
|
We have a fair number of reftests with ellipse borders, so if this passes those, it should be fine. We'll need a gecko try though as well. |
|
@pcwalton OK, the reftests are failing - but it might just be subpixel differences from the reference image. If you run |
|
@glennw OK, I fixed failures relating to zero-width borders and updated the various reftests. |
|
Cropped the reference images. r? @glennw |
ellipse rather than computing the exact distance. This is a well-known trick. It's described in Loop-Blinn and is thoroughly detailed in G. Taubin, "Distance Approximations for Rasterizing Implicit Curves".
|
Rebased and pushed updated Linux-specific reftest images. Let's see if CI is happy now. |
|
There are some failures in the gecko try. The R8 and R4 failures are known (#2405). From a quick look at the R3 failures, they seem to be subpixel differences between the SVG rendered blob and the WR rendered version. I think they should all be fine to fuzz - but I'll get @staktrace to confirm before we merge. |
|
r=me if @staktrace is happy with the try, btw. |
|
Sorry for the delay. The R3 failures look fine - those tests are all fuzzy already and the increase in fuzz is just by one in most cases, so I'm fine with that. The R4 one was not fuzzy before as far as I know (I don't see anything about it in #2405?) but the changes are minor and I'm ok with fuzzing it now. R8 failure is known, as @glennw said. So I'm good with this, thanks! |
Ignore this bit, #2405 introduced nondeterministic fuzziness, so that confused me for a bit. |
|
@bors-servo r+ |
|
|
Use one iteration of Newton's method to approximate distance to an ellipse rather than computing the exact distance. This is a well-known trick. It's described in Loop-Blinn and is thoroughly detailed in G. Taubin, "Distance Approximations for Rasterizing Implicit Curves". I've verified that this looks good for circular borders, elliptical borders, and both under rotation. Perspective is broken, but in the same way it's already broken in master (see #2421). Let me know if there are any reftests/etc. you'd like me to add. r? @glennw <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2423) <!-- Reviewable:end -->
|
|
pcwalton commentedFeb 14, 2018
•
edited by larsbergstrom
This is a well-known trick. It's described in Loop-Blinn and is
thoroughly detailed in G. Taubin, "Distance Approximations for
Rasterizing Implicit Curves".
I've verified that this looks good for circular borders, elliptical borders, and both under rotation. Perspective is broken, but in the same way it's already broken in master (see #2421).
Let me know if there are any reftests/etc. you'd like me to add.
r? @glennw
This change is