aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-07-04 19:45:11 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-07-04 19:45:11 +0800
commit3cc222d662bc96186bbd19fa75e44ac98e54cbb1 (patch)
tree00efbd4a3eae127e520d9a5be770b5dbe009dd6f
parent2f6643d36031df340dc5b154be579d13bc0de58e (diff)
downloadgsoc2013-empathy-3cc222d662bc96186bbd19fa75e44ac98e54cbb1.tar
gsoc2013-empathy-3cc222d662bc96186bbd19fa75e44ac98e54cbb1.tar.gz
gsoc2013-empathy-3cc222d662bc96186bbd19fa75e44ac98e54cbb1.tar.bz2
gsoc2013-empathy-3cc222d662bc96186bbd19fa75e44ac98e54cbb1.tar.lz
gsoc2013-empathy-3cc222d662bc96186bbd19fa75e44ac98e54cbb1.tar.xz
gsoc2013-empathy-3cc222d662bc96186bbd19fa75e44ac98e54cbb1.tar.zst
gsoc2013-empathy-3cc222d662bc96186bbd19fa75e44ac98e54cbb1.zip
ui-utils: factor out pixbuf_round_corners()
-rw-r--r--libempathy-gtk/empathy-ui-utils.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 8d4689ae1..a2f7a75c6 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -468,37 +468,41 @@ empathy_gdk_pixbuf_is_opaque (GdkPixbuf *pixbuf)
}
static GdkPixbuf *
-avatar_pixbuf_from_loader (GdkPixbufLoader *loader)
+pixbuf_round_corners (GdkPixbuf *pixbuf)
{
- GdkPixbuf *pixbuf;
-
- pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+ GdkPixbuf *result;
if (!gdk_pixbuf_get_has_alpha (pixbuf))
{
- GdkPixbuf *rounded_pixbuf;
-
- rounded_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
+ result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf));
gdk_pixbuf_copy_area (pixbuf, 0, 0,
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
- rounded_pixbuf,
+ result,
0, 0);
-
- pixbuf = rounded_pixbuf;
}
else
{
- g_object_ref (pixbuf);
+ result = g_object_ref (pixbuf);
}
- if (empathy_gdk_pixbuf_is_opaque (pixbuf))
- empathy_avatar_pixbuf_roundify (pixbuf);
+ if (empathy_gdk_pixbuf_is_opaque (result))
+ empathy_avatar_pixbuf_roundify (result);
- return pixbuf;
+ return result;
+}
+
+static GdkPixbuf *
+avatar_pixbuf_from_loader (GdkPixbufLoader *loader)
+{
+ GdkPixbuf *pixbuf;
+
+ pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+
+ return pixbuf_round_corners (pixbuf);
}
static GdkPixbuf *