iconhelper: Return surface from icon-effect function
All the callers where converting to a surface anyway.
This commit is contained in:
@ -154,13 +154,16 @@ ensure_icon_size (GtkIconHelper *self,
|
|||||||
*height_out = height;
|
*height_out = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkPixbuf *
|
static cairo_surface_t *
|
||||||
ensure_stated_pixbuf_from_pixbuf (GtkIconHelper *self,
|
ensure_stated_surface_from_pixbuf (GtkIconHelper *self,
|
||||||
GtkStyleContext *context,
|
GtkStyleContext *context,
|
||||||
GdkPixbuf *pixbuf)
|
GdkPixbuf *pixbuf,
|
||||||
|
gint scale,
|
||||||
|
GdkWindow *window)
|
||||||
{
|
{
|
||||||
GdkPixbuf *rendered;
|
GdkPixbuf *rendered;
|
||||||
GtkIconSource *source;
|
GtkIconSource *source;
|
||||||
|
cairo_surface_t *surface;
|
||||||
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||||
|
|
||||||
@ -181,7 +184,11 @@ ensure_stated_pixbuf_from_pixbuf (GtkIconHelper *self,
|
|||||||
|
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||||
|
|
||||||
return rendered;
|
surface = gdk_cairo_surface_create_from_pixbuf (rendered, scale, window);
|
||||||
|
|
||||||
|
g_object_unref (rendered);
|
||||||
|
|
||||||
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkIconLookupFlags
|
static GtkIconLookupFlags
|
||||||
@ -356,7 +363,7 @@ ensure_surface_from_pixbuf (GtkIconHelper *self,
|
|||||||
{
|
{
|
||||||
gint width, height;
|
gint width, height;
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
GdkPixbuf *pixbuf, *stated;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
if (get_pixbuf_size (self,
|
if (get_pixbuf_size (self,
|
||||||
context,
|
context,
|
||||||
@ -370,11 +377,7 @@ ensure_surface_from_pixbuf (GtkIconHelper *self,
|
|||||||
else
|
else
|
||||||
pixbuf = g_object_ref (orig_pixbuf);
|
pixbuf = g_object_ref (orig_pixbuf);
|
||||||
|
|
||||||
stated = ensure_stated_pixbuf_from_pixbuf (self, context, pixbuf);
|
surface = ensure_stated_surface_from_pixbuf (self, context, pixbuf, scale, self->priv->window);
|
||||||
g_object_unref (pixbuf);
|
|
||||||
pixbuf = stated;
|
|
||||||
|
|
||||||
surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale, self->priv->window);
|
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
|
|
||||||
return surface;
|
return surface;
|
||||||
@ -446,15 +449,9 @@ ensure_surface_for_gicon (GtkIconHelper *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!symbolic)
|
if (!symbolic)
|
||||||
{
|
surface = ensure_stated_surface_from_pixbuf (self, context, destination, scale, self->priv->window);
|
||||||
GdkPixbuf *rendered;
|
else
|
||||||
|
surface = gdk_cairo_surface_create_from_pixbuf (destination, scale, self->priv->window);
|
||||||
rendered = ensure_stated_pixbuf_from_pixbuf (self, context, destination);
|
|
||||||
g_object_unref (destination);
|
|
||||||
destination = rendered;
|
|
||||||
}
|
|
||||||
|
|
||||||
surface = gdk_cairo_surface_create_from_pixbuf (destination, scale, self->priv->window);
|
|
||||||
g_object_unref (destination);
|
g_object_unref (destination);
|
||||||
|
|
||||||
return surface;
|
return surface;
|
||||||
|
|||||||
Reference in New Issue
Block a user