[gtk+] iconhelper: Move invalidation check
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] iconhelper: Move invalidation check
- Date: Tue, 1 Dec 2015 23:30:50 +0000 (UTC)
commit 751a1a9926561a8284789b7fb46bb0d3c1e20913
Author: Benjamin Otte <otte redhat com>
Date: Sun Nov 29 19:45:52 2015 +0100
iconhelper: Move invalidation check
Just do the invalidation check once, there's no need to do it in every
branch of the switch.
Also remove useless checks: These functions will not be called if we
already have a rendered surface.
gtk/gtkiconhelper.c | 21 +++------------------
1 files changed, 3 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 4f222ad..fff1961 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -546,12 +546,6 @@ ensure_surface_from_surface (GtkIconHelper *self,
GtkStyleContext *context,
cairo_surface_t *orig_surface)
{
- if (!check_invalidate_surface (self, context))
- return;
-
- if (self->priv->rendered_surface)
- return;
-
self->priv->rendered_surface =
cairo_surface_reference (orig_surface);
@@ -622,12 +616,6 @@ ensure_surface_from_pixbuf (GtkIconHelper *self,
GdkPixbuf *pixbuf, *stated;
int scale;
- if (!check_invalidate_surface (self, context))
- return;
-
- if (self->priv->rendered_surface)
- return;
-
if (get_pixbuf_size (self,
context,
orig_pixbuf,
@@ -657,9 +645,6 @@ ensure_surface_for_icon_set (GtkIconHelper *self,
{
gint scale;
- if (!check_invalidate_surface (self, context))
- return;
-
scale = get_scale_factor (self, context);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
@@ -741,9 +726,6 @@ ensure_surface_for_gicon (GtkIconHelper *self,
GtkIconInfo *info;
GtkIconLookupFlags flags;
- if (!check_invalidate_surface (self, context))
- return;
-
icon_theme = gtk_icon_theme_get_for_screen (gtk_style_context_get_screen (context));
flags = get_icon_lookup_flags (self, context);
@@ -769,6 +751,9 @@ _gtk_icon_helper_ensure_surface (GtkIconHelper *self,
GtkIconSet *icon_set;
GIcon *gicon;
+ if (!check_invalidate_surface (self, context))
+ return self->priv->rendered_surface;
+
switch (gtk_image_definition_get_storage_type (self->priv->def))
{
case GTK_IMAGE_SURFACE:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]