diff --git a/gsk/gl/gskglrenderjob.c b/gsk/gl/gskglrenderjob.c index 570d99665e..d1a581f135 100644 --- a/gsk/gl/gskglrenderjob.c +++ b/gsk/gl/gskglrenderjob.c @@ -2445,8 +2445,8 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job, const GskRenderNode *node) { const GskRoundedRect *outline = gsk_outset_shadow_node_get_outline (node); - float scale_x = job->scale_x; - float scale_y = job->scale_y; + float scale_x = fabsf (job->scale_x); + float scale_y = fabsf (job->scale_y); float blur_radius = gsk_outset_shadow_node_get_blur_radius (node); float blur_extra = blur_radius * 2.0f; /* 2.0 = shader radius_multiplier */ float half_blur_extra = blur_extra / 2.0f; @@ -2577,8 +2577,8 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job, &offscreen, texture_width, texture_height, - blur_radius * fabsf (scale_x), - blur_radius * fabsf (scale_y)); + blur_radius * scale_x, + blur_radius * scale_y); gsk_gl_shadow_library_insert (job->driver->shadows_library, &scaled_outline, diff --git a/gsk/gpu/gskgpunodeprocessor.c b/gsk/gpu/gskgpunodeprocessor.c index d3bc55cb16..0349abe0bd 100644 --- a/gsk/gpu/gskgpunodeprocessor.c +++ b/gsk/gpu/gskgpunodeprocessor.c @@ -2104,7 +2104,7 @@ gsk_gpu_node_processor_add_inset_shadow_node (GskGpuNodeProcessor *self, spread = gsk_inset_shadow_node_get_spread (node); blur_radius = gsk_inset_shadow_node_get_blur_radius (node); - if (blur_radius == 0) + if (blur_radius < 0.01) { float color[4]; @@ -2156,7 +2156,7 @@ gsk_gpu_node_processor_add_outset_shadow_node (GskGpuNodeProcessor *self, dx = gsk_outset_shadow_node_get_dx (node); dy = gsk_outset_shadow_node_get_dy (node); - if (blur_radius == 0) + if (blur_radius < 0.01) { GskRoundedRect outline; float color[4]; diff --git a/gsk/gpu/shaders/gskgpuboxshadow.glsl b/gsk/gpu/shaders/gskgpuboxshadow.glsl index 5294e0b87d..f74cc78734 100644 --- a/gsk/gpu/shaders/gskgpuboxshadow.glsl +++ b/gsk/gpu/shaders/gskgpuboxshadow.glsl @@ -111,14 +111,18 @@ blur_corner (vec2 p, if (min (r.x, r.y) <= 0.0) return 0.0; + p /= _sigma; + r /= _sigma; float result = 0.0; - float step = max (1.0, r.y / 8.0); - for (float y = 0.5 * step; y <= r.y; y += step) + float start = max (p.y - 3.0, 0.0); + float end = min (p.y + 3.0, r.y); + float step = (end - start) / 7.0; + for (float y = start; y <= end; y += step) { float x = r.x - ellipse_x (r, r.y - y); - result -= gauss (p.y - y, _sigma.y) * erf_range (vec2 (- p.x, x - p.x), _sigma.x); + result -= gauss (p.y - y, 1.0) * erf_range (vec2 (- p.x, x - p.x), 1.0); } - return result; + return step * result; } float diff --git a/testsuite/gsk/compare/outset-shadow-corner-blur-huge-nocairo-nogl.node b/testsuite/gsk/compare/outset-shadow-corner-blur-huge-nocairo-nogl.node new file mode 100644 index 0000000000..054c3d3ce2 --- /dev/null +++ b/testsuite/gsk/compare/outset-shadow-corner-blur-huge-nocairo-nogl.node @@ -0,0 +1,10 @@ +clip { + clip: 1400 1400 20 20; + child: color-matrix { + matrix: matrix3d(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255); + child: outset-shadow { + blur: 1000; + outline: 0 0 1000 1000 / 1000 0 1000 0; + } + } +} diff --git a/testsuite/gsk/compare/outset-shadow-corner-blur-huge-nocairo-nogl.png b/testsuite/gsk/compare/outset-shadow-corner-blur-huge-nocairo-nogl.png new file mode 100644 index 0000000000..02d28f5626 Binary files /dev/null and b/testsuite/gsk/compare/outset-shadow-corner-blur-huge-nocairo-nogl.png differ diff --git a/testsuite/gsk/compare/outset-shadow-corner-blur-tiny.node b/testsuite/gsk/compare/outset-shadow-corner-blur-tiny.node new file mode 100644 index 0000000000..a61362eb6d --- /dev/null +++ b/testsuite/gsk/compare/outset-shadow-corner-blur-tiny.node @@ -0,0 +1,11 @@ +color { + bounds: 0 0 100 100; + color: rgba(0,0,0,0); +} +clip { + clip: 10 10 20 20; + child: outset-shadow { + blur: 0.00001; + outline: 0 0 100 100 / 100 0 100 0; + } +} diff --git a/testsuite/gsk/compare/outset-shadow-corner-blur-tiny.png b/testsuite/gsk/compare/outset-shadow-corner-blur-tiny.png new file mode 100644 index 0000000000..eea25d772f Binary files /dev/null and b/testsuite/gsk/compare/outset-shadow-corner-blur-tiny.png differ diff --git a/testsuite/gsk/compare/outset-shadow-corner-blur.node b/testsuite/gsk/compare/outset-shadow-corner-blur.node new file mode 100644 index 0000000000..ac1bd33bd7 --- /dev/null +++ b/testsuite/gsk/compare/outset-shadow-corner-blur.node @@ -0,0 +1,7 @@ +clip { + clip: 0 0 15 15; + child: outset-shadow { + blur: 10; + outline: 0 0 100 100 / 100 0 100 0; + } +} diff --git a/testsuite/gsk/compare/outset-shadow-corner-blur.png b/testsuite/gsk/compare/outset-shadow-corner-blur.png new file mode 100644 index 0000000000..781abc4fd4 Binary files /dev/null and b/testsuite/gsk/compare/outset-shadow-corner-blur.png differ diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build index dfdf585790..55f6c88726 100644 --- a/testsuite/gsk/meson.build +++ b/testsuite/gsk/meson.build @@ -119,6 +119,9 @@ compare_render_tests = [ 'opacity-colormatrix-combinations', 'opacity-overdraw', 'opacity-overlapping-children', + 'outset-shadow-corner-blur', + 'outset-shadow-corner-blur-huge-nocairo-nogl', + 'outset-shadow-corner-blur-tiny', 'outset_shadow_offset_both', 'outset_shadow_offset_x', 'outset_shadow_offset_y',