summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-06-29 14:50:47 +0200
committerraveit65 <[email protected]>2016-07-02 10:26:46 +0200
commitd01add284292c932f2db6408b057e8dcfc7dcb36 (patch)
tree1f16c7260b66b5037d33cc2278a51c5148e0792c
parentba4fb3a39a3f960f9deb949d08063dc58312a7e7 (diff)
downloadmate-desktop-d01add284292c932f2db6408b057e8dcfc7dcb36.tar.bz2
mate-desktop-d01add284292c932f2db6408b057e8dcfc7dcb36.tar.xz
GTK+-3 mate-bg: fix gradiant color creation
credits to Alexei Sorokin
-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;