[gnome-control-center/wip/jsparber/background: 35/58] [feat] use cached pixbuf if the preview size didn't change
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/jsparber/background: 35/58] [feat] use cached pixbuf if the preview size didn't change
- Date: Fri, 24 Nov 2017 21:47:42 +0000 (UTC)
commit a24302b89c9e6a190a635a76dfd490bbd2ed8747
Author: Julian Sparber <julian sparber net>
Date: Wed Nov 8 19:41:29 2017 +0100
[feat] use cached pixbuf if the preview size didn't change
panels/background/cc-background-panel.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index 265cd23..ff6d3c9 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -177,8 +177,10 @@ get_or_create_cached_pixbuf (CcBackgroundPanel *panel,
const gint preview_height = gtk_widget_get_allocated_height (widget);
pixbuf = g_object_get_data (G_OBJECT (background), "pixbuf");
- if (pixbuf == NULL)
- {
+ if (pixbuf == NULL ||
+ gdk_pixbuf_get_width (pixbuf) != preview_width ||
+ gdk_pixbuf_get_height (pixbuf) != preview_height) {
+
gtk_widget_get_allocation (widget, &allocation);
scale_factor = gtk_widget_get_scale_factor (widget);
pixbuf = cc_background_item_get_frame_thumbnail (background,
@@ -187,7 +189,7 @@ get_or_create_cached_pixbuf (CcBackgroundPanel *panel,
preview_height,
scale_factor,
-2, TRUE);
- //g_object_set_data_full (G_OBJECT (background), "pixbuf", pixbuf, g_object_unref);
+ g_object_set_data_full (G_OBJECT (background), "pixbuf", pixbuf, g_object_unref);
}
return pixbuf;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]