mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
gpu: Draw proper shadows again
The fix in commit 5e7f227d
broke shadows while trying to make them
faster.
So use a better way to make them faster.
With the normalized blur radius, we can now conclude that all the values
too far from p.y will cause the gauss() call to return close to 0, so we
can skip any y value that is too far from p.y.
And that allows us to put an upper limit on the loop iterations.
Tests included
Fixes #6888
This commit is contained in:
parent
5059ae1d7b
commit
cc3ed89e34
@ -114,13 +114,15 @@ blur_corner (vec2 p,
|
||||
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, 1.0) * erf_range (vec2 (- p.x, x - p.x), 1.0);
|
||||
}
|
||||
return result;
|
||||
return step * result;
|
||||
}
|
||||
|
||||
float
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 112 B |
7
testsuite/gsk/compare/outset-shadow-corner-blur.node
Normal file
7
testsuite/gsk/compare/outset-shadow-corner-blur.node
Normal file
@ -0,0 +1,7 @@
|
||||
clip {
|
||||
clip: 0 0 15 15;
|
||||
child: outset-shadow {
|
||||
blur: 10;
|
||||
outline: 0 0 100 100 / 100 0 100 0;
|
||||
}
|
||||
}
|
BIN
testsuite/gsk/compare/outset-shadow-corner-blur.png
Normal file
BIN
testsuite/gsk/compare/outset-shadow-corner-blur.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
@ -119,6 +119,8 @@ compare_render_tests = [
|
||||
'opacity-colormatrix-combinations',
|
||||
'opacity-overdraw',
|
||||
'opacity-overlapping-children',
|
||||
'outset-shadow-corner-blur',
|
||||
'outset-shadow-corner-blur-huge-nocairo-nogl',
|
||||
'outset_shadow_offset_both',
|
||||
'outset_shadow_offset_x',
|
||||
'outset_shadow_offset_y',
|
||||
|
Loading…
Reference in New Issue
Block a user