[gtksourceview/wip/chergert/gsv-gtk4: 98/192] markattributes: port to GTK 4
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/gsv-gtk4: 98/192] markattributes: port to GTK 4
- Date: Fri, 7 Aug 2020 18:31:07 +0000 (UTC)
commit a143b7fbb0f9f05d40d46f9765fb5cbea90ffddd
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 6a2f7058d..24f65d73a 100644
--- a/gtksourceview/gtksourcemarkattributes.c
+++ b/gtksourceview/gtksourcemarkattributes.c
@@ -529,21 +529,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 29cb0c85b..867d93929 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]