summaryrefslogtreecommitdiff
path: root/applets/notification_area/status-notifier
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2017-01-24 15:28:40 +0100
committerAlexei Sorokin <[email protected]>2017-01-24 17:39:17 +0300
commit34dbe117b0ca67b5c1e80e11b529e9863c9c9758 (patch)
tree05776588eb5deb56f7f7b72acb5b46f3485d10e3 /applets/notification_area/status-notifier
parent1c7cea2fed9c95bdf3b1831f8287ecdc551152b6 (diff)
downloadmate-panel-34dbe117b0ca67b5c1e80e11b529e9863c9c9758.tar.bz2
mate-panel-34dbe117b0ca67b5c1e80e11b529e9863c9c9758.tar.xz
status-notifier: Fix item icons transparency
Diffstat (limited to 'applets/notification_area/status-notifier')
-rw-r--r--applets/notification_area/status-notifier/sn-item-v0.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/applets/notification_area/status-notifier/sn-item-v0.c b/applets/notification_area/status-notifier/sn-item-v0.c
index 0ef0570a..0ab07ce4 100644
--- a/applets/notification_area/status-notifier/sn-item-v0.c
+++ b/applets/notification_area/status-notifier/sn-item-v0.c
@@ -344,6 +344,9 @@ surface_from_variant (GVariant *variant,
cairo_format_t format;
gint stride;
guint32 *data;
+ gint x;
+ gint y;
+ guchar *p;
format = CAIRO_FORMAT_ARGB32;
stride = cairo_format_stride_for_width (format, width);
@@ -358,6 +361,22 @@ surface_from_variant (GVariant *variant,
}
#endif
+ p = (guchar *) data;
+ /* premultiply alpha for Cairo */
+ for (y = 0; y < height; y++)
+ {
+ for (x = 0; x < width; x++)
+ {
+ guchar alpha = p[x * 4 + 3];
+
+ p[x * 4 + 0] = (p[x * 4 + 0] * alpha) / 255;
+ p[x * 4 + 1] = (p[x * 4 + 1] * alpha) / 255;
+ p[x * 4 + 2] = (p[x * 4 + 2] * alpha) / 255;
+ }
+
+ p += stride;
+ }
+
return cairo_image_surface_create_for_data ((guchar *) data, format,
width, height, stride);
}