[gnome-control-center/gbsneto/background: 3/5] background: Use the cairo_t provided by GTK
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gbsneto/background: 3/5] background: Use the cairo_t provided by GTK
- Date: Wed, 22 May 2019 22:28:57 +0000 (UTC)
commit fef5e46de9ae4bf3a155e3bb019ef2563cfe8572
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed May 22 16:33:16 2019 -0300
background: Use the cairo_t provided by GTK
Instead of creating our own one using a deprecated function.
panels/background/cc-background-panel.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index 3f0a4416b..c00e69c25 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -96,19 +96,15 @@ get_or_create_cached_pixbuf (CcBackgroundPanel *panel,
static void
update_display_preview (CcBackgroundPanel *panel,
GtkWidget *widget,
+ cairo_t *cr,
CcBackgroundItem *background)
{
- GdkPixbuf *pixbuf;
- cairo_t *cr;
+ g_autoptr(GdkPixbuf) pixbuf = NULL;
pixbuf = get_or_create_cached_pixbuf (panel, widget, background);
- cr = gdk_cairo_create (gtk_widget_get_window (widget));
- gdk_cairo_set_source_pixbuf (cr,
- pixbuf,
- 0, 0);
+ gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
cairo_paint (cr);
- cairo_destroy (cr);
}
static CcBackgroundItem *
@@ -448,7 +444,7 @@ on_preview_draw_cb (GtkWidget *widget,
cairo_t *cr,
CcBackgroundPanel *panel)
{
- update_display_preview (panel, widget, panel->current_background);
+ update_display_preview (panel, widget, cr, panel->current_background);
return TRUE;
}
@@ -457,7 +453,7 @@ on_lock_preview_draw_cb (GtkWidget *widget,
cairo_t *cr,
CcBackgroundPanel *panel)
{
- update_display_preview (panel, widget, panel->current_lock_background);
+ update_display_preview (panel, widget, cr, panel->current_lock_background);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]