Commit 1b553478 authored by Benjamin Otte's avatar Benjamin Otte

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.
parent 6c20ddc1
......@@ -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);
......
......@@ -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 \
......
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;
}
<?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>
<?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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment