зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1600141 - Fix rounded clip rects with radii < 1px. r=nical
Differential Revision: https://phabricator.services.mozilla.com/D55203 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
bc6ecf6708
Коммит
a793c1ca32
|
@ -118,8 +118,13 @@ void main(void) {
|
|||
|
||||
#ifdef WR_FEATURE_FAST_PATH
|
||||
// See http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
|
||||
float sdf_rounded_rect(vec2 pos, vec3 clip_params) {
|
||||
return length(max(abs(pos) - clip_params.xy, 0.0)) - clip_params.z;
|
||||
float sd_box(in vec2 pos, in vec2 box_size) {
|
||||
vec2 d = abs(pos) - box_size;
|
||||
return length(max(d, vec2(0.0))) + min(max(d.x,d.y), 0.0);
|
||||
}
|
||||
|
||||
float sd_rounded_box(in vec2 pos, in vec2 box_size, in float radius) {
|
||||
return sd_box(pos, box_size) - radius;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -128,7 +133,7 @@ void main(void) {
|
|||
float aa_range = compute_aa_range(local_pos);
|
||||
|
||||
#ifdef WR_FEATURE_FAST_PATH
|
||||
float d = sdf_rounded_rect(local_pos, vClipParams);
|
||||
float d = sd_rounded_box(local_pos, vClipParams.xy, vClipParams.z);
|
||||
float f = distance_aa(aa_range, d);
|
||||
float final_alpha = mix(f, 1.0 - f, vClipMode);
|
||||
#else
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
root:
|
||||
items:
|
||||
- type: rect
|
||||
bounds: 20 50 100 100
|
||||
color: blue
|
||||
|
||||
- type: rect
|
||||
bounds: 140 50 100 100
|
||||
color: blue
|
||||
|
||||
- type: rect
|
||||
bounds: 260 50 100 100
|
||||
color: blue
|
||||
|
||||
- type: rect
|
||||
bounds: 380 50 100 100
|
||||
color: blue
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
root:
|
||||
items:
|
||||
- type: clip
|
||||
bounds: [20, 50, 100, 100]
|
||||
complex:
|
||||
- rect: [20, 50, 100, 100]
|
||||
radius: 0
|
||||
items:
|
||||
- type: rect
|
||||
bounds: 20 50 100 100
|
||||
color: blue
|
||||
|
||||
- type: clip
|
||||
bounds: [140, 50, 100, 100]
|
||||
complex:
|
||||
- rect: [140, 50, 100, 100]
|
||||
radius: 0.001
|
||||
items:
|
||||
- type: rect
|
||||
bounds: 140 50 100 100
|
||||
color: blue
|
||||
|
||||
- type: clip
|
||||
bounds: [260, 50, 100, 100]
|
||||
complex:
|
||||
- rect: [260, 50, 100, 100]
|
||||
radius: 0.01
|
||||
items:
|
||||
- type: rect
|
||||
bounds: 260 50 100 100
|
||||
color: blue
|
||||
|
||||
- type: clip
|
||||
bounds: [380, 50, 100, 100]
|
||||
complex:
|
||||
- rect: [380, 50, 100, 100]
|
||||
radius: 0.1
|
||||
items:
|
||||
- type: rect
|
||||
bounds: 380 50 100 100
|
||||
color: blue
|
|
@ -1,2 +1,3 @@
|
|||
skip_on(android) == rounded-rects.yaml rounded-rects-ref.png # Too wide for Android
|
||||
== aa-dist-bug.yaml aa-dist-bug-ref.yaml
|
||||
== fractional-radii.yaml fractional-radii-ref.yaml
|
||||
|
|
Загрузка…
Ссылка в новой задаче