mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 22:10:08 +00:00
gl: Interpolate gradient colors as premultiplied
Tests included
This commit is contained in:
parent
8de4b04819
commit
9643a21827
@ -75,10 +75,10 @@ void main() {
|
||||
|
||||
if (offset < next_offset) {
|
||||
float f = (offset - curr_offset) / (next_offset - curr_offset);
|
||||
vec4 curr_color = get_color(i);
|
||||
vec4 next_color = get_color(i + 1);
|
||||
vec4 curr_color = gsk_scaled_premultiply (get_color(i), u_alpha);
|
||||
vec4 next_color = gsk_scaled_premultiply (get_color(i + 1), u_alpha);
|
||||
vec4 color = mix(curr_color, next_color, f);
|
||||
gskSetScaledOutputColor(gsk_premultiply(color), u_alpha);
|
||||
gskSetOutputColor(color);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -97,10 +97,10 @@ void main() {
|
||||
|
||||
if (offset < next_offset) {
|
||||
float f = (offset - curr_offset) / (next_offset - curr_offset);
|
||||
vec4 curr_color = get_color(i);
|
||||
vec4 next_color = get_color(i + 1);
|
||||
vec4 curr_color = gsk_scaled_premultiply (get_color(i), u_alpha);
|
||||
vec4 next_color = gsk_scaled_premultiply (get_color(i + 1), u_alpha);
|
||||
vec4 color = mix(curr_color, next_color, f);
|
||||
gskSetScaledOutputColor(gsk_premultiply (color), u_alpha);
|
||||
gskSetOutputColor(color);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -77,10 +77,10 @@ void main() {
|
||||
|
||||
if (offset < next_offset) {
|
||||
float f = (offset - curr_offset) / (next_offset - curr_offset);
|
||||
vec4 curr_color = get_color(i);
|
||||
vec4 next_color = get_color(i + 1);
|
||||
vec4 curr_color = gsk_scaled_premultiply (get_color(i), u_alpha);
|
||||
vec4 next_color = gsk_scaled_premultiply (get_color(i + 1), u_alpha);
|
||||
vec4 color = mix(curr_color, next_color, f);
|
||||
gskSetScaledOutputColor(gsk_premultiply(color), u_alpha);
|
||||
gskSetOutputColor(color);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
color-matrix {
|
||||
matrix: matrix3d(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 100);
|
||||
child: container {
|
||||
conic-gradient {
|
||||
bounds: 0 0 50 50;
|
||||
center: 25 25;
|
||||
stops: 0 rgb(255,0,0), 0.6 rgba(0,255,255,0);
|
||||
}
|
||||
conic-gradient {
|
||||
bounds: 0 0 50 50;
|
||||
center: 25 25;
|
||||
stops: 0.4 rgba(0,255,255,0), 1 rgb(255,0,0);
|
||||
}
|
||||
}
|
||||
}
|
BIN
testsuite/gsk/compare/conic-gradient-premultiplied-nocairo.png
Normal file
BIN
testsuite/gsk/compare/conic-gradient-premultiplied-nocairo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 114 B |
@ -0,0 +1,9 @@
|
||||
color-matrix {
|
||||
matrix: matrix3d(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 100);
|
||||
child: linear-gradient {
|
||||
bounds: 0 0 50 50;
|
||||
start: 0 -50;
|
||||
end: 0 100;
|
||||
stops: 0 rgb(255,0,0), 1 rgba(0,255,255,0);
|
||||
}
|
||||
}
|
BIN
testsuite/gsk/compare/linear-gradient-premultiplied-nocairo.png
Normal file
BIN
testsuite/gsk/compare/linear-gradient-premultiplied-nocairo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 114 B |
@ -0,0 +1,10 @@
|
||||
color-matrix {
|
||||
matrix: matrix3d(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 100);
|
||||
child: radial-gradient {
|
||||
bounds: 0 0 50 50;
|
||||
center: 25 25;
|
||||
hradius: 40;
|
||||
vradius: 40;
|
||||
stops: 0 rgb(255,0,0), 1 rgba(0,255,255,0);
|
||||
}
|
||||
}
|
BIN
testsuite/gsk/compare/radial-gradient-premultiplied-nocairo.png
Normal file
BIN
testsuite/gsk/compare/radial-gradient-premultiplied-nocairo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 114 B |
@ -48,6 +48,7 @@ compare_render_tests = [
|
||||
'color-matrix-merge',
|
||||
'color-matrix-parsing',
|
||||
'color-states',
|
||||
'conic-gradient-premultiplied-nocairo',
|
||||
'conic-gradient-with-64-colorstops',
|
||||
'container-single-child-offscreen-for-opacity',
|
||||
'crossfade-clip-both-children',
|
||||
@ -100,6 +101,7 @@ compare_render_tests = [
|
||||
'issue-3615',
|
||||
'linear-gradient-3d-nocairo',
|
||||
'linear-gradient-nonorthogonal-scale-nogl',
|
||||
'linear-gradient-premultiplied-nocairo',
|
||||
'linear-gradient-with-64-colorstops',
|
||||
'lots-of-offscreens-nogl',
|
||||
'mask',
|
||||
@ -133,6 +135,7 @@ compare_render_tests = [
|
||||
'outset-shadow-scale-offset',
|
||||
'outset_shadow_simple',
|
||||
'premul-color-nogl',
|
||||
'radial-gradient-premultiplied-nocairo',
|
||||
'radial-gradient-with-64-colorstops',
|
||||
'repeat',
|
||||
'repeating-linear-gradient-edge-colors',
|
||||
|
Loading…
Reference in New Issue
Block a user