mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
1be21a33d9
We can use this to properly compute distance in scaled situations. We also now compute coverage with (imperfect) antialiasing.
18 lines
359 B
GLSL
18 lines
359 B
GLSL
#ifndef _ROUNDED_RECT_FRAG_
|
|
#define _ROUNDED_RECT_FRAG_
|
|
|
|
#include "rounded-rect.glsl"
|
|
|
|
float
|
|
rounded_rect_coverage (RoundedRect r, vec2 p)
|
|
{
|
|
vec2 fw = abs (fwidth (p));
|
|
float distance_scale = max (fw.x, fw.y);
|
|
float distance = rounded_rect_distance (r, p) / distance_scale;
|
|
float coverage = 0.5 - distance;
|
|
|
|
return clamp (coverage, 0, 1);
|
|
}
|
|
|
|
#endif
|