Align corner clipping, antialiasing, and fractional material regions
This commit is contained in:
1 parent
f110ec80e1
commit
9666e4ff6c
16 files changed
+237
-68
No files matched your search
@@ -6,5 +6,6 @@ float rounded_rect_distance(vec2 point, vec4 rect, float radius) {
|
||||
}
|
||||
|
||||
float edge_coverage(float distance) {
|
||||
return 1.0 - smoothstep(-0.5, 0.5, distance);
|
||||
// Match Iced/WGPU quad edges: a one-physical-pixel linear ramp.
|
||||
return clamp(0.5 - distance, 0.0, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
precision highp float;
|
||||
uniform float alpha;
|
||||
uniform vec4 clip_rect;
|
||||
uniform float radius;
|
||||
uniform vec4 color;
|
||||
|
||||
//_CORNERS_
|
||||
|
||||
void main() {
|
||||
float distance = rounded_rect_distance(gl_FragCoord.xy, clip_rect, radius);
|
||||
// Single-pixel buffer colors are already premultiplied.
|
||||
gl_FragColor = color * alpha * edge_coverage(distance);
|
||||
}
|
||||
Reference in new issue
Block a user