New issue
Advanced search Search tips

Issue 631507 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Rounded border rendering is totally broken

Reported by teo8...@gmail.com, Jul 26 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36

Example URL:
http://output.jsbin.com/xomipi

Steps to reproduce the problem:
1. visit http://output.jsbin.com/xomipi
2. look at the rounded border around the "x"

What is the expected behavior?
i) The border should be a perfect circle, because the border-radius is exactly half of the width and height

ii) Whether or not (i) holds (i.e. even for other sizes), the junctions between the rounded corners and the straight part of the borders should be unnoticeable.

What went wrong?
i) the rounded corner radius is not half of the height and width: there is a short straight piece of border on each side

ii) the junctions between the rounded corners and the straight borders is shitty. You can clearly see 8 "dots" at the junctions

Actually I wonder if issue (i) is not actually true and is instead just a visual artifact due to (ii)

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? Yes 

Chrome version: 51.0.2704.106  Channel: n/a
OS Version: 
Flash Version: Shockwave Flash 22.0 r0

Pathetic.
 
Screenshot from 2016-07-26 18-44-14.png
1.0 KB View Download

Comment 1 by bokan@chromium.org, Jul 26 2016

Labels: Needs-Feedback
Is this just a duplicate of issue 631508, "antialiasing makes rounded borders look bad"?

Comment 2 by bokan@chromium.org, Jul 26 2016

Cc: bokan@chromium.org

Comment 3 by teo8...@gmail.com, Jul 26 2016

There might of course be a common underlying cause, but there seem to be two different issues: 631508 is about the poor arc drawing. This one is about an artifact at the junction between the arc and the straight line.


By the way, I was wrong about the border being supposed to be a perfect circle (wasn't taking into account that the radius is the outer one, so there's an extra pixel), but the issue about the junctions still holds.

Comment 4 by bokan@chromium.org, Jul 26 2016

Components: -Blink Blink>Paint
Labels: -Needs-Feedback
Owner: schenney@chromium.org
Status: Assigned (was: Unconfirmed)
I'll need to look at this on a machine where I can see individual pixels when zoomed, but it is the case that when drawing a circle using minimum error methods into a raster backing, you get straight sections on the sides that do not look dissimilar to the image given. It's just the way it is trying to draw a continuous thing on discrete pixels.

I'd be curious what an SVG circle the same size looks like? I know it won't be exactly the same because we use bezier arc approximations for border corners.

Comment 6 by teo8...@gmail.com, Jul 26 2016

> I'll need to look at this on a machine where I can see individual pixels 
> when zoomed

Or you can take a screen capture and zoom it in an image viewer or editor ;)

> but it is the case that when drawing a circle using minimum error methods 
> into a raster backing, you get straight sections on the sides

Forget about the straight sections within the arcs, that's issue 631508 (they shouldn't exist, no matter what, but I don't really observe them in this test case).


The issue here is the artifacts at the point where the the arc begins and ends, and joins with the (expected) straight part of the border (the part that is not a rounded corner).

Here's a less confusing test case:
http://jsbin.com/fuyujuh/edit?html,css,output
xxx.png
3.4 KB View Download
zoomed.png
3.1 KB View Download
Status: WontFix (was: Assigned)
What you are seeing is the transition from the straight initial curve segment to the first pixel that is off the straight segment. In other words, part of the border radius curve is straight and exactly aligned with the straight part of the border, as expected.

Comment 8 by teo8...@gmail.com, Sep 14 2016

Please somebody not retarded review this

Comment 9 by teo8...@gmail.com, Sep 14 2016

@schenney try to draw the exact same shape with any vector drawing software and you'll see that the junction can be rendered better.

That is NOT the expected result, you can clearly notice eight "dots", where the line looks thicker, there's no reason for that. It's poorly rendered, period.

Comment 10 by teo8...@gmail.com, Sep 14 2016

Indeed, the problem seems to be that the ending of the curve and the straight line are NOT exactly alligned (as they should be). The curve seems to be drawn "one pixel inwards"
Re comment #8, see https://www.chromium.org/conduct

The ending of the curve and the straight line are exactly aligned. You can identify where the straight segment ends and where the curve segment begins and at that point the curve is continuous. Your complaint is with the anti-aliasing artifacts of the curve drawing, and that is a valid concern.

However, Chrome is not vector drawing software, it is a web browser that must trade off performance against visual fidelity across a very high range of devices and content. The bug is WontFix because we will not devote resources to improving this particular rendering.

Comment 12 by teo8...@gmail.com, Sep 14 2016

>  Your complaint is with the anti-aliasing artifacts of the curve drawing, 
> and that is a valid concern.

Ok now we are talking. You started comment 7 with "what you are seeing is..." and ended with "as expected", which seemed to imply that this was the expected behavior.


> The bug is WontFix because we will not devote resources to improving 
> this particular rendering.

So for you it is acceptable that the rendering of all rounded-corner rectangles is just broken??
Unbelievable.

Oh, but Firefox does it even worse, so I guess it's ok.

> it is a web browser that must trade off performance against visual fidelity

I'm pretty sure a decent result can be obtained without compromising performance.


Comment 13 by f...@opera.com, Sep 14 2016

I guess this could be something like https://bugs.chromium.org/p/skia/issues/detail?id=5017 (i.e number of gray-levels used by the rasterizer.) If this is most notable for 1px borders, I'd also suspect hairline rendering, but some quick testing didn't seem to indicate that.
"totally broken" is certainly an exaggeration, but there's a case to be made for improved AA.

I think at least part of it is related to (the current lack of) color space correction: Skia interpolates in linear space, but the result is dumped to a non-linear device without correction - so 50% black coverage for example doesn't translate to 50% gray, visually.

Luckily there are people working on color correction in Skia as I type this, so as soon as Chromium starts to take advantage of it things should get better.

E.g. see the attached examples (columns are CPU vs. GPU rendering, PNGs are linear/uncorrected vs. SRGB/corrected).
aa_linear.png
4.0 KB View Download
aa_srgb.png
4.9 KB View Download

Comment 15 by teo8...@gmail.com, Sep 15 2016

> E.g. see the attached examples (columns are CPU vs. GPU rendering, 
> PNGs are linear/uncorrected vs. SRGB/corrected).

Which one is supposed to demonstrate an improvement? Both sides of aa_srgb.png are broken (the curves being systematically thinner/lighter than the straight lines). 

Of the "linear" ones, the one on the left  looks pretty much like the current behavior. The one on the right (GPU?) has the curves noticeably thicker than the straight lines (given that, it's hard to tell whether it also has the artifact at the junction, or if it is the result of the transition from a thinner to a thicker line).


I am genuinely surprised to see this stuff. I understand that the problem of correctly drawing and antialiasing a 1-pixel-thick line (or a line of any width for that matter), with straight and curved portions and no discontinuities (or with them, for that matter), is a complex one. But hasn't it already been solved like decades ago?
> Which one is supposed to demonstrate an improvement? Both sides of aa_srgb.png are broken (the curves being systematically thinner/lighter than the straight lines). 

You are looking at the unscaled image (open in a separate tab), and not the scaled-down version above, right?

Comment 17 by teo8...@gmail.com, Sep 15 2016

> You are looking at the unscaled image (open in a separate tab), 
> and not the scaled-down version above, right?

Of course! 

And then (for the sake of curiosity) I am also looking at the images in GIMPP zoomed in by multiples of 200% (without any kind of interpolation).

And you think aa_srgb.png looks bad at native rez?  I gotta admit that sounded crazy, but come to think of it it's not all that surprising.

For the record, on my IPS monitor aa_srgb.png looks as good as I could ever expect (and much better than aa_linear.png, which as you've noticed is what we currently output).

But moving the tab to a TFT monitor, it does get slightly worse.  By now you may have figured where this is going.

Essentially, it's impossible to have "perfect" AA without full monitor color matching.  Back to my prev example, 50% black coverage needs to show up exactly midway between your monitor's black and white.  But that's totally dependent on your monitor's color gamut!

I've rendered that image assuming an SRGB profile, so if your monitor is not SRGB (or deviates from it somehow), it'll not look as good.  You could try different displays, and see if it makes a difference.

Sign in to add a comment