Bug 1346915 - Update webrender to 7da345684dc29ca60f29cb79acc8d99c474ec477. r=me

This picks up a fix for a bug introduced in a previous update.

MozReview-Commit-ID: JAPml5JTVJi
This commit is contained in:
Kartikaya Gupta 2017-03-14 08:37:54 -04:00
Родитель 860e7d0cdf
Коммит 8904708de7
3 изменённых файлов: 61 добавлений и 12 удалений

Просмотреть файл

@ -79,4 +79,4 @@ to make sure that mozjs_sys also has its Cargo.lock file updated if needed, henc
the need to run the cargo update command in js/src as well. Hopefully this will the need to run the cargo update command in js/src as well. Hopefully this will
be resolved soon. be resolved soon.
Latest Commit: e30fb2914928c0e596d8632ed234647c0fd1492e Latest Commit: 7da345684dc29ca60f29cb79acc8d99c474ec477

Просмотреть файл

@ -56,12 +56,57 @@ float alpha_for_solid_border(float distance_from_ref,
return 1.0 - smoothstep(0.0, 1.0, distance_from_border); return 1.0 - smoothstep(0.0, 1.0, distance_from_border);
} }
float alpha_for_solid_ellipse_border(vec2 local_pos,
vec2 inner_radius,
vec2 outer_radius,
float pixels_per_fragment) {
vec2 distance_from_ref = local_pos - vRefPoint;
float nudge = pixels_per_fragment;
inner_radius += nudge;
outer_radius -= nudge;
float inner_ellipse = distance_from_ref.x * distance_from_ref.x / inner_radius.x / inner_radius.x +
distance_from_ref.y * distance_from_ref.y / inner_radius.y / inner_radius.y;
float outer_ellipse = distance_from_ref.x * distance_from_ref.x / outer_radius.x / outer_radius.x +
distance_from_ref.y * distance_from_ref.y / outer_radius.y / outer_radius.y;
if (inner_ellipse > 1.0 && outer_ellipse < 1.0) {
return 1.0;
}
vec2 offset = step(inner_radius.yx, inner_radius.xy) *
(sqrt(abs(inner_radius.x * inner_radius.x - inner_radius.y * inner_radius.y)));
vec2 focus1 = vRefPoint + offset;
vec2 focus2 = vRefPoint - offset;
float inner_distance_from_border = max(inner_radius.x, inner_radius.y) -
(distance(focus1, local_pos) + distance(focus2, local_pos)) / 2.0;
offset = step(outer_radius.yx, outer_radius.xy) *
(sqrt(abs(outer_radius.x * outer_radius.x - outer_radius.y * outer_radius.y)));
focus1 = vRefPoint + offset;
focus2 = vRefPoint - offset;
float outer_distance_from_border = (distance(focus1, local_pos) + distance(focus2, local_pos)) / 2.0 -
max(outer_radius.x, outer_radius.y);
float distance_from_border = max(inner_distance_from_border, outer_distance_from_border);
// Move the distance back into pixels.
distance_from_border /= pixels_per_fragment;
return 1.0 - smoothstep(0.0, 1.0, distance_from_border);
}
float alpha_for_solid_border_corner(vec2 local_pos, float alpha_for_solid_border_corner(vec2 local_pos,
float inner_radius, vec2 inner_radius,
float outer_radius, vec2 outer_radius,
float pixels_per_fragment) { float pixels_per_fragment) {
float distance_from_ref = distance(vRefPoint, local_pos); if (inner_radius.x == inner_radius.y && outer_radius.x == outer_radius.y) {
return alpha_for_solid_border(distance_from_ref, inner_radius, outer_radius, pixels_per_fragment); float distance_from_ref = distance(vRefPoint, local_pos);
return alpha_for_solid_border(distance_from_ref, inner_radius.x, outer_radius.x, pixels_per_fragment);
} else {
return alpha_for_solid_ellipse_border(local_pos, inner_radius, outer_radius, pixels_per_fragment);
}
} }
vec4 draw_dotted_edge(vec2 local_pos, vec4 piece_rect, float pixels_per_fragment) { vec4 draw_dotted_edge(vec2 local_pos, vec4 piece_rect, float pixels_per_fragment) {
@ -144,8 +189,8 @@ void draw_dashed_or_dotted_border(vec2 local_pos, float distance_from_mix_line)
oFragColor = get_fragment_color(distance_from_mix_line, pixels_per_fragment); oFragColor = get_fragment_color(distance_from_mix_line, pixels_per_fragment);
if (vRadii.x > 0.0) { if (vRadii.x > 0.0) {
oFragColor *= vec4(1.0, 1.0, 1.0, alpha_for_solid_border_corner(local_pos, oFragColor *= vec4(1.0, 1.0, 1.0, alpha_for_solid_border_corner(local_pos,
vRadii.z, vRadii.zw,
vRadii.x, vRadii.xy,
pixels_per_fragment)); pixels_per_fragment));
} }
@ -216,17 +261,20 @@ vec4 draw_double_edge_corner_with_radius(vec2 local_pos,
float pixels_per_fragment) { float pixels_per_fragment) {
float total_border_width = vRadii.x - vRadii.z; float total_border_width = vRadii.x - vRadii.z;
float one_third_width = total_border_width / 3.0; float one_third_width = total_border_width / 3.0;
float total_border_height = vRadii.y - vRadii.w;
float one_third_height = total_border_height / 3.0;
// Contribution of the outer border segment. // Contribution of the outer border segment.
float alpha = alpha_for_solid_border_corner(local_pos, float alpha = alpha_for_solid_border_corner(local_pos,
vRadii.x - one_third_width, vec2(vRadii.x - one_third_width,
vRadii.x, vRadii.y - one_third_height),
vec2(vRadii.x, vRadii.y),
pixels_per_fragment); pixels_per_fragment);
// Contribution of the inner border segment. // Contribution of the inner border segment.
alpha += alpha_for_solid_border_corner(local_pos, alpha += alpha_for_solid_border_corner(local_pos,
vRadii.z, vec2(vRadii.z, vRadii.w),
vRadii.z + one_third_width, vec2(vRadii.z + one_third_width, vRadii.w + one_third_height),
pixels_per_fragment); pixels_per_fragment);
return get_fragment_color(distance_from_mix_line, pixels_per_fragment) * vec4(1.0, 1.0, 1.0, alpha); return get_fragment_color(distance_from_mix_line, pixels_per_fragment) * vec4(1.0, 1.0, 1.0, alpha);
} }
@ -291,7 +339,7 @@ void draw_solid_border(float distanceFromMixLine, vec2 localPos) {
oFragColor = get_fragment_color(distanceFromMixLine, pixelsPerFragment); oFragColor = get_fragment_color(distanceFromMixLine, pixelsPerFragment);
if (vRadii.x > 0.0) { if (vRadii.x > 0.0) {
float alpha = alpha_for_solid_border_corner(localPos, vRadii.z, vRadii.x, pixelsPerFragment); float alpha = alpha_for_solid_border_corner(localPos, vRadii.zw, vRadii.xy, pixelsPerFragment);
oFragColor *= vec4(1.0, 1.0, 1.0, alpha); oFragColor *= vec4(1.0, 1.0, 1.0, alpha);
} }

Просмотреть файл

@ -414,6 +414,7 @@ impl DisplayListBuilder {
_ => {} _ => {}
} }
i.clip.complex = self.auxiliary_lists_builder.add_complex_clip_regions(aux.complex_clip_regions(&i.clip.complex)); i.clip.complex = self.auxiliary_lists_builder.add_complex_clip_regions(aux.complex_clip_regions(&i.clip.complex));
i.scroll_layer_id = *self.clip_stack.last().unwrap();
self.list.push(i); self.list.push(i);
} }
} }