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.
This commit is contained in:
@ -546,12 +546,6 @@ ensure_surface_from_surface (GtkIconHelper *self,
|
|||||||
GtkStyleContext *context,
|
GtkStyleContext *context,
|
||||||
cairo_surface_t *orig_surface)
|
cairo_surface_t *orig_surface)
|
||||||
{
|
{
|
||||||
if (!check_invalidate_surface (self, context))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (self->priv->rendered_surface)
|
|
||||||
return;
|
|
||||||
|
|
||||||
self->priv->rendered_surface =
|
self->priv->rendered_surface =
|
||||||
cairo_surface_reference (orig_surface);
|
cairo_surface_reference (orig_surface);
|
||||||
|
|
||||||
@ -622,12 +616,6 @@ ensure_surface_from_pixbuf (GtkIconHelper *self,
|
|||||||
GdkPixbuf *pixbuf, *stated;
|
GdkPixbuf *pixbuf, *stated;
|
||||||
int scale;
|
int scale;
|
||||||
|
|
||||||
if (!check_invalidate_surface (self, context))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (self->priv->rendered_surface)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (get_pixbuf_size (self,
|
if (get_pixbuf_size (self,
|
||||||
context,
|
context,
|
||||||
orig_pixbuf,
|
orig_pixbuf,
|
||||||
@ -657,9 +645,6 @@ ensure_surface_for_icon_set (GtkIconHelper *self,
|
|||||||
{
|
{
|
||||||
gint scale;
|
gint scale;
|
||||||
|
|
||||||
if (!check_invalidate_surface (self, context))
|
|
||||||
return;
|
|
||||||
|
|
||||||
scale = get_scale_factor (self, context);
|
scale = get_scale_factor (self, context);
|
||||||
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||||
@ -741,9 +726,6 @@ ensure_surface_for_gicon (GtkIconHelper *self,
|
|||||||
GtkIconInfo *info;
|
GtkIconInfo *info;
|
||||||
GtkIconLookupFlags flags;
|
GtkIconLookupFlags flags;
|
||||||
|
|
||||||
if (!check_invalidate_surface (self, context))
|
|
||||||
return;
|
|
||||||
|
|
||||||
icon_theme = gtk_icon_theme_get_for_screen (gtk_style_context_get_screen (context));
|
icon_theme = gtk_icon_theme_get_for_screen (gtk_style_context_get_screen (context));
|
||||||
flags = get_icon_lookup_flags (self, context);
|
flags = get_icon_lookup_flags (self, context);
|
||||||
|
|
||||||
@ -769,6 +751,9 @@ _gtk_icon_helper_ensure_surface (GtkIconHelper *self,
|
|||||||
GtkIconSet *icon_set;
|
GtkIconSet *icon_set;
|
||||||
GIcon *gicon;
|
GIcon *gicon;
|
||||||
|
|
||||||
|
if (!check_invalidate_surface (self, context))
|
||||||
|
return self->priv->rendered_surface;
|
||||||
|
|
||||||
switch (gtk_image_definition_get_storage_type (self->priv->def))
|
switch (gtk_image_definition_get_storage_type (self->priv->def))
|
||||||
{
|
{
|
||||||
case GTK_IMAGE_SURFACE:
|
case GTK_IMAGE_SURFACE:
|
||||||
|
|||||||
Reference in New Issue
Block a user