summaryrefslogtreecommitdiff
path: root/libmate-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'libmate-desktop')
-rw-r--r--libmate-desktop/mate-bg.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index cf63d32..5f28dde 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -2718,9 +2718,15 @@ create_gradient (const GdkColor *primary,
for (i = 0; i < n_pixels; ++i) {
double ratio = (i + 0.5) / n_pixels;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ result[3 * i + 0] = (guchar) ((primary->red * (1 - ratio) + secondary->red * ratio) * 0x100);
+ result[3 * i + 1] = (guchar) ((primary->green * (1 - ratio) + secondary->green * ratio) * 0x100);
+ result[3 * i + 2] = (guchar) ((primary->blue * (1 - ratio) + secondary->blue * ratio) * 0x100);
+#else
result[3 * i + 0] = ((guint16) (primary->red * (1 - ratio) + secondary->red * ratio)) >> 8;
result[3 * i + 1] = ((guint16) (primary->green * (1 - ratio) + secondary->green * ratio)) >> 8;
result[3 * i + 2] = ((guint16) (primary->blue * (1 - ratio) + secondary->blue * ratio)) >> 8;
+#endif
}
return result;