[metacity/gnome-3-20] libmetacity: fix gradients
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity/gnome-3-20] libmetacity: fix gradients
- Date: Thu, 7 Jul 2016 16:03:09 +0000 (UTC)
commit 4b5175ff8ab044abc8635d3778364dd6001dcf8e
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Jul 7 18:39:54 2016 +0300
libmetacity: fix gradients
libmetacity/meta-gradient-spec.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/libmetacity/meta-gradient-spec.c b/libmetacity/meta-gradient-spec.c
index bb6a98d..70affdd 100644
--- a/libmetacity/meta-gradient-spec.c
+++ b/libmetacity/meta-gradient-spec.c
@@ -74,17 +74,23 @@ create_cairo_pattern_from_gradient_spec (const MetaGradientSpec *spec,
meta_color_spec_render (tmp->data, context, &color);
if (alpha_spec != NULL)
- cairo_pattern_add_color_stop_rgba (pattern, i / (gfloat) n_colors,
+ cairo_pattern_add_color_stop_rgba (pattern, i / (gfloat) (n_colors - 1),
color.red, color.green, color.blue,
- alpha_spec->alphas[i]);
+ alpha_spec->alphas[i] / 255.0);
else
- cairo_pattern_add_color_stop_rgb (pattern, i / (gfloat) n_colors,
+ cairo_pattern_add_color_stop_rgb (pattern, i / (gfloat) (n_colors - 1),
color.red, color.green, color.blue);
tmp = tmp->next;
++i;
}
+ if (cairo_pattern_status (pattern) != CAIRO_STATUS_SUCCESS)
+ {
+ cairo_pattern_destroy (pattern);
+ return NULL;
+ }
+
return pattern;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]