[gtksourceview/wip/chergert/gsv-gtk4: 93/125] markattributes: port to GTK 4
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/gsv-gtk4: 93/125] markattributes: port to GTK 4
- Date: Wed, 15 Jan 2020 23:54:11 +0000 (UTC)
commit 46fe9c9cea0f9471c67d45d785b2d1834c9f5157
Author: Christian Hergert <chergert redhat com>
Date: Wed Jan 15 14:23:55 2020 -0800
markattributes: port to GTK 4
- Use GdkPaintable instead of GdkPixbuf for better GPU caching
gtksourceview/gtksourcemarkattributes.c | 16 +++++++++++-----
gtksourceview/gtksourcemarkattributes.h | 2 +-
2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/gtksourceview/gtksourcemarkattributes.c b/gtksourceview/gtksourcemarkattributes.c
index 95f3785f..946c7fb9 100644
--- a/gtksourceview/gtksourcemarkattributes.c
+++ b/gtksourceview/gtksourcemarkattributes.c
@@ -531,21 +531,27 @@ gtk_source_mark_attributes_get_pixbuf (GtkSourceMarkAttributes *attributes)
* gtk_source_mark_attributes_set_gicon() or
* gtk_source_mark_attributes_set_icon_name(). @size cannot be lower than 1.
*
- * Returns: (transfer none): A rendered pixbuf. The pixbuf belongs to @attributes
+ * Returns: (transfer none): A #GdkPaintable. The paintable belongs to @attributes
* and should not be unreffed.
*/
-const GdkPixbuf *
+GdkPaintable *
gtk_source_mark_attributes_render_icon (GtkSourceMarkAttributes *attributes,
GtkWidget *widget,
gint size)
{
+ GdkPaintable *ret;
+
g_return_val_if_fail (GTK_SOURCE_IS_MARK_ATTRIBUTES (attributes), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
g_return_val_if_fail (size > 0, NULL);
- return gtk_source_pixbuf_helper_render (attributes->helper,
- widget,
- size);
+ ret = gtk_source_pixbuf_helper_render (attributes->helper,
+ widget,
+ size);
+
+ g_return_val_if_fail (ret == NULL || GDK_IS_PAINTABLE (ret), NULL);
+
+ return ret;
}
/**
diff --git a/gtksourceview/gtksourcemarkattributes.h b/gtksourceview/gtksourcemarkattributes.h
index 29cb0c85..867d9392 100644
--- a/gtksourceview/gtksourcemarkattributes.h
+++ b/gtksourceview/gtksourcemarkattributes.h
@@ -60,7 +60,7 @@ void gtk_source_mark_attributes_set_pixbuf (GtkSourc
GTK_SOURCE_AVAILABLE_IN_ALL
const GdkPixbuf *gtk_source_mark_attributes_get_pixbuf (GtkSourceMarkAttributes *attributes);
GTK_SOURCE_AVAILABLE_IN_ALL
-const GdkPixbuf *gtk_source_mark_attributes_render_icon (GtkSourceMarkAttributes *attributes,
+GdkPaintable *gtk_source_mark_attributes_render_icon (GtkSourceMarkAttributes *attributes,
GtkWidget *widget,
gint size);
GTK_SOURCE_AVAILABLE_IN_ALL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]