summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2017-01-01 13:40:13 +0100
committerBenjamin Otte <otte@redhat.com>2017-01-01 19:53:36 +0100
commit2571036c077b88203039703de7a66b6e45c20566 (patch)
tree9baaa9aca61fe025792e1ce9bc3f55a7e1d6cb4a
parent4ead5c3ba8bb1ab570b00f392eb654514ce42c4a (diff)
downloadgtk+-2571036c077b88203039703de7a66b6e45c20566.tar.gz
gsk: Turn GskTexture into a GObject
-rw-r--r--docs/reference/gsk/gsk4-sections.txt2
-rw-r--r--gsk/gskrendernodeimpl.c6
-rw-r--r--gsk/gsktexture.c354
-rw-r--r--gsk/gsktexture.h13
-rw-r--r--gsk/gsktextureprivate.h10
-rw-r--r--gtk/gtkcssimageicontheme.c2
-rw-r--r--gtk/gtkcssimagesurface.c6
-rw-r--r--gtk/gtkiconhelper.c4
-rw-r--r--gtk/gtksnapshot.c2
-rw-r--r--tests/rendernode.c4
10 files changed, 254 insertions, 149 deletions
diff --git a/docs/reference/gsk/gsk4-sections.txt b/docs/reference/gsk/gsk4-sections.txt
index a74d4ad671..158b41551d 100644
--- a/docs/reference/gsk/gsk4-sections.txt
+++ b/docs/reference/gsk/gsk4-sections.txt
@@ -82,8 +82,6 @@ GSK_TYPE_SERIALIZATION_ERROR
<SECTION>
<FILE>GskTexture</FILE>
-gsk_texture_ref
-gsk_texture_unref
gsk_texture_new_for_data
gsk_texture_new_for_pixbuf
gsk_texture_get_width
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index 61d504ed86..9a4203f588 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -664,7 +664,7 @@ gsk_texture_node_finalize (GskRenderNode *node)
{
GskTextureNode *self = (GskTextureNode *) node;
- gsk_texture_unref (self->texture);
+ g_object_unref (self->texture);
}
static void
@@ -745,7 +745,7 @@ gsk_texture_node_deserialize (GVariant *variant,
node = gsk_texture_node_new (texture, &GRAPHENE_RECT_INIT(bounds[0], bounds[1], bounds[2], bounds[3]));
- gsk_texture_unref (texture);
+ g_object_unref (texture);
return node;
}
@@ -793,7 +793,7 @@ gsk_texture_node_new (GskTexture *texture,
self = (GskTextureNode *) gsk_render_node_new (&GSK_TEXTURE_NODE_CLASS, 0);
- self->texture = gsk_texture_ref (texture);
+ self->texture = g_object_ref (texture);
graphene_rect_init_from_rect (&self->render_node.bounds, bounds);
return &self->render_node;
diff --git a/gsk/gsktexture.c b/gsk/gsktexture.c
index cc8cdedfce..f373aed045 100644
--- a/gsk/gsktexture.c
+++ b/gsk/gsktexture.c
@@ -25,9 +25,9 @@
*
* You cannot get your pixel data back once you've uploaded it.
*
- * #GskTexture is an immutable structure: That means you cannot change
+ * #GskTexture is an immutable object: That means you cannot change
* anything about it other than increasing the reference count via
- * gsk_texture_ref().
+ * g_object_ref().
*/
#include "config.h"
@@ -40,116 +40,208 @@
#include "gdk/gdkinternals.h"
/**
- * GskTexture: (ref-func gsk_texture_ref) (unref-func gsk_texture_unref)
+ * GskTexture:
*
* The `GskTexture` structure contains only private data.
*
* Since: 3.90
*/
-G_DEFINE_BOXED_TYPE(GskTexture, gsk_texture, gsk_texture_ref, gsk_texture_unref)
+enum {
+ PROP_0,
+ PROP_WIDTH,
+ PROP_HEIGHT,
-static void
-gsk_texture_finalize (GskTexture *self)
-{
- gsk_texture_clear_render_data (self);
+ N_PROPS
+};
- self->klass->finalize (self);
+static GParamSpec *properties[N_PROPS];
- g_free (self);
+G_DEFINE_ABSTRACT_TYPE (GskTexture, gsk_texture, G_TYPE_OBJECT)
+
+#define GSK_TEXTURE_WARN_NOT_IMPLEMENTED_METHOD(obj,method) \
+ g_critical ("Texture of type '%s' does not implement GskTexture::" # method, G_OBJECT_TYPE_NAME (obj))
+
+static void
+gsk_texture_real_download (GskTexture *self,
+ guchar *data,
+ gsize stride)
+{
+ GSK_TEXTURE_WARN_NOT_IMPLEMENTED_METHOD (self, download);
}
-/**
- * gsk_texture_ref:
- * @texture: a #GskTexture
- *
- * Acquires a reference on the given #GskTexture.
- *
- * Returns: (transfer none): the #GskTexture with an additional reference
- *
- * Since: 3.90
- */
-GskTexture *
-gsk_texture_ref (GskTexture *texture)
+static cairo_surface_t *
+gsk_texture_real_download_surface (GskTexture *texture)
{
- g_return_val_if_fail (GSK_IS_TEXTURE (texture), NULL);
+ cairo_surface_t *surface;
- g_atomic_int_inc (&texture->ref_count);
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ texture->width, texture->height);
+ gsk_texture_download (texture,
+ cairo_image_surface_get_data (surface),
+ cairo_image_surface_get_stride (surface));
+ cairo_surface_mark_dirty (surface);
- return texture;
+ return surface;
}
-/**
- * gsk_texture_unref:
- * @texture: a #GskTexture
- *
- * Releases a reference on the given #GskTexture.
- *
- * If the reference was the last, the resources associated to the @texture are
- * freed.
- *
- * Since: 3.90
- */
-void
-gsk_texture_unref (GskTexture *texture)
+static void
+gsk_texture_set_property (GObject *gobject,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- g_return_if_fail (GSK_IS_TEXTURE (texture));
-
- if (g_atomic_int_dec_and_test (&texture->ref_count))
- gsk_texture_finalize (texture);
+ GskTexture *self = GSK_TEXTURE (gobject);
+
+ switch (prop_id)
+ {
+ case PROP_WIDTH:
+ self->width = g_value_get_int (value);
+ break;
+
+ case PROP_HEIGHT:
+ self->height = g_value_get_int (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
+ break;
+ }
}
-gpointer
-gsk_texture_new (const GskTextureClass *klass,
- int width,
- int height)
+static void
+gsk_texture_get_property (GObject *gobject,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- GskTexture *self;
+ GskTexture *self = GSK_TEXTURE (gobject);
+
+ switch (prop_id)
+ {
+ case PROP_WIDTH:
+ g_value_set_int (value, self->width);
+ break;
+
+ case PROP_HEIGHT:
+ g_value_set_int (value, self->height);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
+ break;
+ }
+}
- g_assert (klass->size >= sizeof (GskTexture));
+static void
+gsk_texture_dispose (GObject *object)
+{
+ GskTexture *self = GSK_TEXTURE (object);
- self = g_malloc0 (klass->size);
+ gsk_texture_clear_render_data (self);
- self->klass = klass;
- self->ref_count = 1;
+ G_OBJECT_CLASS (gsk_texture_parent_class)->dispose (object);
+}
- self->width = width;
- self->height = height;
+static void
+gsk_texture_class_init (GskTextureClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ klass->download = gsk_texture_real_download;
+ klass->download_surface = gsk_texture_real_download_surface;
+
+ gobject_class->set_property = gsk_texture_set_property;
+ gobject_class->get_property = gsk_texture_get_property;
+ gobject_class->dispose = gsk_texture_dispose;
+
+ /**
+ * GskRenderer:width:
+ *
+ * The width of the texture.
+ *
+ * Since: 3.90
+ */
+ properties[PROP_WIDTH] =
+ g_param_spec_int ("width",
+ "Width",
+ "The width of the texture",
+ 1,
+ G_MAXINT,
+ 1,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_EXPLICIT_NOTIFY);
+
+ /**
+ * GskRenderer:height:
+ *
+ * The height of the texture.
+ *
+ * Since: 3.90
+ */
+ properties[PROP_HEIGHT] =
+ g_param_spec_int ("height",
+ "Height",
+ "The height of the texture",
+ 1,
+ G_MAXINT,
+ 1,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_EXPLICIT_NOTIFY);
+
+ g_object_class_install_properties (gobject_class, N_PROPS, properties);
+}
- return self;
+static void
+gsk_texture_init (GskTexture *self)
+{
}
/* GskCairoTexture */
-typedef struct _GskCairoTexture GskCairoTexture;
+#define GSK_TYPE_CAIRO_TEXTURE (gsk_cairo_texture_get_type ())
+
+G_DECLARE_FINAL_TYPE (GskCairoTexture, gsk_cairo_texture, GSK, CAIRO_TEXTURE, GskTexture)
struct _GskCairoTexture {
- GskTexture texture;
+ GskTexture parent_instance;
cairo_surface_t *surface;
};
+struct _GskCairoTextureClass {
+ GskTextureClass parent_class;
+};
+
+G_DEFINE_TYPE (GskCairoTexture, gsk_cairo_texture, GSK_TYPE_TEXTURE)
+
static void
-gsk_texture_cairo_finalize (GskTexture *texture)
+gsk_cairo_texture_finalize (GObject *object)
{
- GskCairoTexture *cairo = (GskCairoTexture *) texture;
+ GskCairoTexture *self = GSK_CAIRO_TEXTURE (object);
+
+ cairo_surface_destroy (self->surface);
- cairo_surface_destroy (cairo->surface);
+ G_OBJECT_CLASS (gsk_cairo_texture_parent_class)->finalize (object);
}
static cairo_surface_t *
-gsk_texture_cairo_download_surface (GskTexture *texture)
+gsk_cairo_texture_download_surface (GskTexture *texture)
{
- GskCairoTexture *cairo = (GskCairoTexture *) texture;
+ GskCairoTexture *self = GSK_CAIRO_TEXTURE (texture);
- return cairo_surface_reference (cairo->surface);
+ return cairo_surface_reference (self->surface);
}
static void
-gsk_texture_cairo_download (GskTexture *texture,
+gsk_cairo_texture_download (GskTexture *texture,
guchar *data,
gsize stride)
{
- GskCairoTexture *cairo = (GskCairoTexture *) texture;
+ GskCairoTexture *self = GSK_CAIRO_TEXTURE (texture);
cairo_surface_t *surface;
cairo_t *cr;
@@ -159,7 +251,7 @@ gsk_texture_cairo_download (GskTexture *texture,
stride);
cr = cairo_create (surface);
- cairo_set_source_surface (cr, cairo->surface, 0, 0);
+ cairo_set_source_surface (cr, self->surface, 0, 0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
@@ -168,28 +260,21 @@ gsk_texture_cairo_download (GskTexture *texture,
cairo_surface_destroy (surface);
}
-static const GskTextureClass GSK_TEXTURE_CLASS_CAIRO = {
- "cairo",
- sizeof (GskCairoTexture),
- gsk_texture_cairo_finalize,
- gsk_texture_cairo_download,
- gsk_texture_cairo_download_surface
-};
-
-GskTexture *
-gsk_texture_new_for_surface (cairo_surface_t *surface)
+static void
+gsk_cairo_texture_class_init (GskCairoTextureClass *klass)
{
- GskCairoTexture *texture;
-
- g_return_val_if_fail (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE, NULL);
+ GskTextureClass *texture_class = GSK_TEXTURE_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- texture = gsk_texture_new (&GSK_TEXTURE_CLASS_CAIRO,
- cairo_image_surface_get_width (surface),
- cairo_image_surface_get_height (surface));
+ texture_class->download = gsk_cairo_texture_download;
+ texture_class->download_surface = gsk_cairo_texture_download_surface;
- texture->surface = cairo_surface_reference (surface);
+ gobject_class->finalize = gsk_cairo_texture_finalize;
+}
- return (GskTexture *) texture;
+static void
+gsk_cairo_texture_init (GskCairoTexture *self)
+{
}
GskTexture *
@@ -213,75 +298,114 @@ gsk_texture_new_for_data (const guchar *data,
texture = gsk_texture_new_for_surface (copy);
cairo_surface_destroy (copy);
+ cairo_surface_finish (original);
cairo_surface_destroy (original);
return texture;
}
+GskTexture *
+gsk_texture_new_for_surface (cairo_surface_t *surface)
+{
+ GskCairoTexture *texture;
+
+ g_return_val_if_fail (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE, NULL);
+
+ texture = g_object_new (GSK_TYPE_CAIRO_TEXTURE,
+ "width", cairo_image_surface_get_width (surface),
+ "height", cairo_image_surface_get_height (surface),
+ NULL);
+
+ texture->surface = cairo_surface_reference (surface);
+
+ return (GskTexture *) texture;
+}
+
/* GskPixbufTexture */
-typedef struct _GskPixbufTexture GskPixbufTexture;
+#define GSK_TYPE_PIXBUF_TEXTURE (gsk_pixbuf_texture_get_type ())
+
+G_DECLARE_FINAL_TYPE (GskPixbufTexture, gsk_pixbuf_texture, GSK, PIXBUF_TEXTURE, GskTexture)
struct _GskPixbufTexture {
- GskTexture texture;
+ GskTexture parent_instance;
+
GdkPixbuf *pixbuf;
};
+struct _GskPixbufTextureClass {
+ GskTextureClass parent_class;
+};
+
+G_DEFINE_TYPE (GskPixbufTexture, gsk_pixbuf_texture, GSK_TYPE_TEXTURE)
+
static void
-gsk_texture_pixbuf_finalize (GskTexture *texture)
+gsk_pixbuf_texture_finalize (GObject *object)
{
- GskPixbufTexture *pixbuf = (GskPixbufTexture *) texture;
+ GskPixbufTexture *self = GSK_PIXBUF_TEXTURE (object);
- g_object_unref (pixbuf->pixbuf);
+ g_object_unref (self->pixbuf);
+
+ G_OBJECT_CLASS (gsk_pixbuf_texture_parent_class)->finalize (object);
}
static void
-gsk_texture_pixbuf_download (GskTexture *texture,
+gsk_pixbuf_texture_download (GskTexture *texture,
guchar *data,
gsize stride)
{
- GskPixbufTexture *pixbuf = (GskPixbufTexture *) texture;
+ GskPixbufTexture *self = GSK_PIXBUF_TEXTURE (texture);
cairo_surface_t *surface;
surface = cairo_image_surface_create_for_data (data,
CAIRO_FORMAT_ARGB32,
texture->width, texture->height,
stride);
- gdk_cairo_surface_paint_pixbuf (surface, pixbuf->pixbuf);
+ gdk_cairo_surface_paint_pixbuf (surface, self->pixbuf);
cairo_surface_finish (surface);
cairo_surface_destroy (surface);
}
static cairo_surface_t *
-gsk_texture_pixbuf_download_surface (GskTexture *texture)
+gsk_pixbuf_texture_download_surface (GskTexture *texture)
{
- GskPixbufTexture *pixbuf = (GskPixbufTexture *) texture;
+ GskPixbufTexture *self = GSK_PIXBUF_TEXTURE (texture);
- return gdk_cairo_surface_create_from_pixbuf (pixbuf->pixbuf, 1, NULL);
+ return gdk_cairo_surface_create_from_pixbuf (self->pixbuf, 1, NULL);
}
-static const GskTextureClass GSK_TEXTURE_CLASS_PIXBUF = {
- "pixbuf",
- sizeof (GskPixbufTexture),
- gsk_texture_pixbuf_finalize,
- gsk_texture_pixbuf_download,
- gsk_texture_pixbuf_download_surface
-};
+static void
+gsk_pixbuf_texture_class_init (GskPixbufTextureClass *klass)
+{
+ GskTextureClass *texture_class = GSK_TEXTURE_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ texture_class->download = gsk_pixbuf_texture_download;
+ texture_class->download_surface = gsk_pixbuf_texture_download_surface;
+
+ gobject_class->finalize = gsk_pixbuf_texture_finalize;
+}
+
+static void
+gsk_pixbuf_texture_init (GskPixbufTexture *self)
+{
+}
GskTexture *
gsk_texture_new_for_pixbuf (GdkPixbuf *pixbuf)
{
- GskPixbufTexture *texture;
+ GskPixbufTexture *self;
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
- texture = gsk_texture_new (&GSK_TEXTURE_CLASS_PIXBUF,
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf));
+ self = g_object_new (GSK_TYPE_PIXBUF_TEXTURE,
+ "width", gdk_pixbuf_get_width (pixbuf),
+ "height", gdk_pixbuf_get_height (pixbuf),
+ NULL);
- texture->pixbuf = g_object_ref (pixbuf);
+ self->pixbuf = g_object_ref (pixbuf);
- return &texture->texture;
+ return GSK_TEXTURE (self);
}
/**
@@ -323,19 +447,7 @@ gsk_texture_get_height (GskTexture *texture)
cairo_surface_t *
gsk_texture_download_surface (GskTexture *texture)
{
- cairo_surface_t *surface;
-
- if (texture->klass->download_surface)
- return texture->klass->download_surface (texture);
-
- surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
- texture->width, texture->height);
- gsk_texture_download (texture,
- cairo_image_surface_get_data (surface),
- cairo_image_surface_get_stride (surface));
- cairo_surface_mark_dirty (surface);
-
- return surface;
+ return GSK_TEXTURE_GET_CLASS (texture)->download_surface (texture);
}
/**
@@ -373,7 +485,7 @@ gsk_texture_download (GskTexture *texture,
g_return_if_fail (data != NULL);
g_return_if_fail (stride >= gsk_texture_get_width (texture) * 4);
- return texture->klass->download (texture, data, stride);
+ return GSK_TEXTURE_GET_CLASS (texture)->download (texture, data, stride);
}
gboolean
diff --git a/gsk/gsktexture.h b/gsk/gsktexture.h
index 67cbe718c4..a241af3da0 100644
--- a/gsk/gsktexture.h
+++ b/gsk/gsktexture.h
@@ -29,15 +29,16 @@ G_BEGIN_DECLS
#define GSK_TYPE_TEXTURE (gsk_texture_get_type ())
-#define GSK_IS_TEXTURE(texture) ((texture) != NULL)
+#define GSK_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_TEXTURE, GskTexture))
+#define GSK_IS_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_TEXTURE))
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GskTexture, g_object_unref)
+
+typedef struct _GskTextureClass GskTextureClass;
-GDK_AVAILABLE_IN_3_90
-GType gsk_texture_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_3_90
-GskTexture * gsk_texture_ref (GskTexture *texture);
-GDK_AVAILABLE_IN_3_90
-void gsk_texture_unref (GskTexture *texture);
+GType gsk_texture_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_3_90
GskTexture * gsk_texture_new_for_data (const guchar *data,
diff --git a/gsk/gsktextureprivate.h b/gsk/gsktextureprivate.h
index 637bc74343..9d4cd105c4 100644
--- a/gsk/gsktextureprivate.h
+++ b/gsk/gsktextureprivate.h
@@ -9,13 +9,9 @@ G_BEGIN_DECLS
#define GSK_IS_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_TEXTURE))
#define GSK_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_TEXTURE, GskTextureClass))
-typedef struct _GskTextureClass GskTextureClass;
-
struct _GskTexture
{
- const GskTextureClass *klass;
-
- volatile int ref_count;
+ GObject parent_instance;
int width;
int height;
@@ -26,10 +22,8 @@ struct _GskTexture
};
struct _GskTextureClass {
- const char *name;
- gsize size;
+ GObjectClass parent_class;
- void (* finalize) (GskTexture *texture);
void (* download) (GskTexture *texture,
guchar *data,
gsize stride);
diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c
index 3037257827..22457909f2 100644
--- a/gtk/gtkcssimageicontheme.c
+++ b/gtk/gtkcssimageicontheme.c
@@ -96,7 +96,7 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image,
),
"CssImageIconTheme<%s@%d>", icon_theme->name, icon_theme->scale);
- gsk_texture_unref (texture);
+ g_object_unref (texture);
g_object_unref (pixbuf);
g_object_unref (icon_info);
}
diff --git a/gtk/gtkcssimagesurface.c b/gtk/gtkcssimagesurface.c
index 70910e3c9e..426a6d1ac3 100644
--- a/gtk/gtkcssimagesurface.c
+++ b/gtk/gtkcssimagesurface.c
@@ -76,7 +76,7 @@ gtk_css_image_surface_dispose (GObject *object)
{
GtkCssImageSurface *surface = GTK_CSS_IMAGE_SURFACE (object);
- g_clear_pointer (&surface->texture, gsk_texture_unref);
+ g_clear_object (&surface->texture);
G_OBJECT_CLASS (_gtk_css_image_surface_parent_class)->dispose (object);
}
@@ -108,7 +108,7 @@ gtk_css_image_surface_new (GskTexture *texture)
image = g_object_new (GTK_TYPE_CSS_IMAGE_SURFACE, NULL);
if (texture)
- GTK_CSS_IMAGE_SURFACE (image)->texture = gsk_texture_ref (texture);
+ GTK_CSS_IMAGE_SURFACE (image)->texture = g_object_ref (texture);
return image;
}
@@ -123,7 +123,7 @@ gtk_css_image_surface_new_for_pixbuf (GdkPixbuf *pixbuf)
texture = gsk_texture_new_for_pixbuf (pixbuf);
image = gtk_css_image_surface_new (texture);
- gsk_texture_unref (texture);
+ g_object_unref (texture);
return image;
}
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index d47c514ee5..72eaa62f72 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -52,7 +52,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (GtkIconHelper, gtk_icon_helper, GTK_TYPE_CSS_GADGET)
void
gtk_icon_helper_invalidate (GtkIconHelper *self)
{
- g_clear_pointer (&self->priv->texture, gsk_texture_unref);
+ g_clear_object (&self->priv->texture);
if (self->priv->rendered_surface != NULL)
{
@@ -99,7 +99,7 @@ gtk_icon_helper_take_definition (GtkIconHelper *self,
void
_gtk_icon_helper_clear (GtkIconHelper *self)
{
- g_clear_pointer (&self->priv->texture, gsk_texture_unref);
+ g_clear_object (&self->priv->texture);
g_clear_pointer (&self->priv->rendered_surface, cairo_surface_destroy);
gtk_image_definition_unref (self->priv->def);
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index f604872cf4..a7bfa7d243 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -1108,6 +1108,6 @@ gtk_snapshot_render_icon (GtkSnapshot *snapshot,
texture,
1);
gtk_snapshot_translate_2d (snapshot, -x, -y);
- gsk_texture_unref (texture);
+ g_object_unref (texture);
}
diff --git a/tests/rendernode.c b/tests/rendernode.c
index 42781a11f5..292be48fad 100644
--- a/tests/rendernode.c
+++ b/tests/rendernode.c
@@ -119,7 +119,7 @@ main(int argc, char **argv)
for (run = 0; run < runs; run++)
{
if (run > 0)
- gsk_texture_unref (texture);
+ g_object_unref (texture);
start = g_get_monotonic_time ();
texture = gsk_renderer_render_texture (renderer, node, NULL);
end = g_get_monotonic_time ();
@@ -134,7 +134,7 @@ main(int argc, char **argv)
cairo_image_surface_get_data (surface),
cairo_image_surface_get_stride (surface));
cairo_surface_mark_dirty (surface);
- gsk_texture_unref (texture);
+ g_object_unref (texture);
g_object_unref (window);
g_object_unref (renderer);
}