mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +00:00
18 lines
359 B
Plaintext
18 lines
359 B
Plaintext
|
#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
|