mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
glsl: Make rounded rect clipping cheaper
Add early acceptance checks for non-corner cases.
This commit is contained in:
parent
5d30569575
commit
57e354c297
@ -50,16 +50,24 @@ gsk_rounded_rect_coverage (GskRoundedRect r, vec2 p)
|
||||
p.x >= r.bounds.z || p.y >= r.bounds.w)
|
||||
return 0.0;
|
||||
|
||||
vec2 rad_tl = r.corner_points1.xy - r.bounds.xy;
|
||||
vec2 rad_tr = r.corner_points1.zw - r.bounds.zy;
|
||||
vec2 rad_br = r.corner_points2.xy - r.bounds.zw;
|
||||
vec2 rad_bl = r.corner_points2.zw - r.bounds.xw;
|
||||
|
||||
vec2 ref_tl = r.corner_points1.xy;
|
||||
vec2 ref_tr = r.corner_points1.zw;
|
||||
vec2 ref_br = r.corner_points2.xy;
|
||||
vec2 ref_bl = r.corner_points2.zw;
|
||||
|
||||
if (p.x >= ref_tl.x && p.x >= ref_bl.x &&
|
||||
p.x <= ref_tr.x && p.x <= ref_br.x)
|
||||
return 1.0;
|
||||
|
||||
if (p.y >= ref_tl.y && p.y >= ref_tr.y &&
|
||||
p.y <= ref_bl.y && p.y <= ref_br.y)
|
||||
return 1.0;
|
||||
|
||||
vec2 rad_tl = r.corner_points1.xy - r.bounds.xy;
|
||||
vec2 rad_tr = r.corner_points1.zw - r.bounds.zy;
|
||||
vec2 rad_br = r.corner_points2.xy - r.bounds.zw;
|
||||
vec2 rad_bl = r.corner_points2.zw - r.bounds.xw;
|
||||
|
||||
float d_tl = gsk_ellipsis_coverage(p, ref_tl, rad_tl);
|
||||
float d_tr = gsk_ellipsis_coverage(p, ref_tr, rad_tr);
|
||||
float d_br = gsk_ellipsis_coverage(p, ref_br, rad_br);
|
||||
|
Loading…
Reference in New Issue
Block a user