gl renderer: Don't invert offset value twice

This commit is contained in:
Timm Bäder 2019-12-17 16:24:17 +01:00
parent d0d2ad9f5b
commit f79c807645
3 changed files with 4 additions and 6 deletions

View File

@ -1555,7 +1555,7 @@ render_unblurred_inset_shadow_node (GskGLRenderer *self,
op->outline = transform_rect (self, builder, gsk_inset_shadow_node_peek_outline (node));
op->spread = spread * scale;
op->offset[0] = dx * scale;
op->offset[1] = -dy * scale;
op->offset[1] = dy * scale;
load_vertex_data (vertex_data, node, builder);
@ -1737,7 +1737,7 @@ render_unblurred_outset_shadow_node (GskGLRenderer *self,
op->outline = transform_rect (self, builder, outline);
op->spread = spread * scale;
op->offset[0] = dx * scale;
op->offset[1] = - dy * scale;
op->offset[1] = dy * scale;
load_vertex_data (vertex_data, node, builder);
ops_draw (builder, vertex_data);

View File

@ -17,10 +17,9 @@ void main() {
RoundedRect outside = create_rect(u_outline_rect);
RoundedRect inside = rounded_rect_shrink(outside, vec4(u_spread));
vec2 offset = vec2(u_offset.x, - u_offset.y);
vec4 color = vec4(u_color.rgb * u_color.a, u_color.a);
color = color * clamp (rounded_rect_coverage (outside, f.xy) -
rounded_rect_coverage (inside, f.xy - offset),
rounded_rect_coverage (inside, f.xy - u_offset),
0.0, 1.0);
setOutputColor(color * u_alpha);
}

View File

@ -19,9 +19,8 @@ void main() {
RoundedRect inside = create_rect(u_outline_rect);
RoundedRect outside = rounded_rect_shrink(inside, vec4(- u_spread));
vec2 offset = vec2(u_offset.x, - u_offset.y);
vec4 color = vec4(u_color.rgb * u_color.a, u_color.a);
color = color * clamp (rounded_rect_coverage (outside, f.xy - offset) -
color = color * clamp (rounded_rect_coverage (outside, f.xy - u_offset) -
rounded_rect_coverage (inside, f.xy),
0.0, 1.0);
setOutputColor(color * u_alpha);