Open pijulius opened 1 month ago
hmmm, thanks for the patch, but i want to understand this problem better.
what corner radius did you use to get these screenshots?
hi @yshui , for sure! I used: corner-radius = 10
and tested with corner radius 1 too and indeed looks fine with that too.
hmm, i wonder if the off by 1 error is actually here:
if (rect_distance > 0.0f) { // <----
c = (1.0f - clamp(rect_distance, 0.0f, 1.0f)) * rim_color;
} else {
float factor = clamp(rect_distance + border_width, 0.0f, 1.0f);
c = (1.0f - factor) * c + factor * border_color;
}
maybe it should be
if (rect_distance > -0.5f) { // <----
c = (0.5f - clamp(rect_distance, -0.5f, 0.5f)) * rim_color;
} else {
float factor = clamp(rect_distance + border_width, 0.0f, 1.0f);
c = (1.0f - factor) * c + factor * border_color;
}
?
Hmmm, I tried that change but it makes shadows disappear, ok, not disappear but to see them I need to set shadow-opacity to 0.9 or so, so it affects the shadow in big way. The -1 I added doesn't seem to affect the shadow at all.
So my current thought is this: texcoord
is at center of pixels (I think this is the case for fragment shaders), so rect_distance == 0
means the pixel center is right at the edge of the circle, which means it should be color at approx. 50%. But we are currently coloring it 100%
FYI: have now fixed rounded corners for the mask too, please see: Fix GLX corner radis for the mask too
Also added this new feature: Add possibility for frame opacity to include menubar/toolbar and so on
not sure what you think about it, if you like it at all can work on formatting and other backends too but for now to showcase and for myself this was enough to achieve what I wanted.
This should fix the corner radius in the glx backend to be almost exactly the same as xrender. Not that good at math myself but I think the problem lies behind the circle already being the right size just the center of it was positioned off a bit and that's why it looked a bit "rectanglish".
Please see attached screenshots.
![corner-glxfix-zoomed](https://github.com/yshui/picom/assets/567420/a2e5d7ce-e0a9-4145-ab7e-6725c412b794)