summaryrefslogtreecommitdiff
path: root/gtk/gtkcssimagelinear.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-10-06 15:54:10 -0400
committerBenjamin Otte <otte@redhat.com>2012-10-06 15:56:08 -0400
commit588ee411ad82b890263d3f56af801681954dfc2c (patch)
tree048464cd950abe1f2b7408f0536a08451a50fce8 /gtk/gtkcssimagelinear.c
parentb454fc50edc2ea42931a84af2712d5f075b51e75 (diff)
downloadgtk+-588ee411ad82b890263d3f56af801681954dfc2c.tar.gz
cssimage: Fix gradient start/end computation
This computation is only supposed to happen for repeating gradients, not for all of them.
Diffstat (limited to 'gtk/gtkcssimagelinear.c')
-rw-r--r--gtk/gtkcssimagelinear.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c
index bd80d5f835..b09131d423 100644
--- a/gtk/gtkcssimagelinear.c
+++ b/gtk/gtkcssimagelinear.c
@@ -40,28 +40,36 @@ gtk_css_image_linear_get_start_end (GtkCssImageLinear *linear,
double pos;
guint i;
- stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, 0);
- if (stop->offset == NULL)
- *start = 0;
- else
- *start = _gtk_css_number_value_get (stop->offset, length) / length;
-
- *end = *start;
-
- for (i = 0; i < linear->stops->len; i++)
+ if (linear->repeating)
{
- stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, i);
-
+ stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, 0);
if (stop->offset == NULL)
- continue;
+ *start = 0;
+ else
+ *start = _gtk_css_number_value_get (stop->offset, length) / length;
- pos = _gtk_css_number_value_get (stop->offset, length) / length;
+ *end = *start;
- *end = MAX (pos, *end);
+ for (i = 0; i < linear->stops->len; i++)
+ {
+ stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, i);
+
+ if (stop->offset == NULL)
+ continue;
+
+ pos = _gtk_css_number_value_get (stop->offset, length) / length;
+
+ *end = MAX (pos, *end);
+ }
+
+ if (stop->offset == NULL)
+ *end = MAX (*end, 1.0);
+ }
+ else
+ {
+ *start = 0;
+ *end = 1;
}
-
- if (stop->offset == NULL)
- *end = MAX (*end, 1.0);
}
static void