cssimageradial: Handle "partial" gradients correctly

When the first/last color stop is not at 0%/100%, we need to start the
repeating at their offsets and not at 0%/100%.

Attached reftest demonstrates the problem.
This commit is contained in:
Benjamin Otte 2016-12-19 23:30:02 +01:00
parent 6c20ddc119
commit 1b553478f6
5 changed files with 36 additions and 1 deletions

View File

@ -163,7 +163,7 @@ gtk_css_image_radial_draw (GtkCssImage *image,
gtk_css_image_radial_get_start_end (radial, radius, &start, &end);
pattern = cairo_pattern_create_radial (0, 0, 0, 0, 0, radius);
pattern = cairo_pattern_create_radial (0, 0, radius * start, 0, 0, radius * end);
if (yscale != 1.0)
{
cairo_matrix_init_scale (&matrix, 1.0, 1.0 / yscale);

View File

@ -377,6 +377,9 @@ testdata = \
quit-mnemonic.css \
quit-mnemonic.ref.ui \
quit-mnemonic.ui \
repeating-radial-gradient-at-beginning.css \
repeating-radial-gradient-at-beginning.ref.ui \
repeating-radial-gradient-at-beginning.ui \
reset-to-defaults.css \
revealer-extra-size.ref.ui \
revealer-extra-size.ui \

View File

@ -0,0 +1,11 @@
window {
background: repeating-radial-gradient(red 50%, blue, red);
}
#reference {
background-image: radial-gradient(red, blue, red), repeating-radial-gradient(red 50%, blue, red);
background-size: 50% 50%, 100% 100%;
background-repeat: no-repeat;
background-position: center;
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="width_request">64</property>
<property name="height_request">32</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
<property name="name">reference</property>
</object>
</interface>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="width_request">64</property>
<property name="height_request">32</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
</object>
</interface>