[libgd/wip/ernestask/gtk4: 5/6] toggle-pixbuf-renderer: use snapshot API for rendering
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd/wip/ernestask/gtk4: 5/6] toggle-pixbuf-renderer: use snapshot API for rendering
- Date: Sat, 10 Mar 2018 10:13:43 +0000 (UTC)
commit acb54a1fc0af3c1e1fba95c46970321f67107e0f
Author: Ernestas Kulik <ernestask gnome org>
Date: Sat Mar 10 11:21:30 2018 +0200
toggle-pixbuf-renderer: use snapshot API for rendering
libgd/gd-toggle-pixbuf-renderer.c | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/libgd/gd-toggle-pixbuf-renderer.c b/libgd/gd-toggle-pixbuf-renderer.c
index bc34d7b..de55a18 100644
--- a/libgd/gd-toggle-pixbuf-renderer.c
+++ b/libgd/gd-toggle-pixbuf-renderer.c
@@ -112,25 +112,34 @@ render_activity (GdTogglePixbufRenderer *self,
}
static void
-gd_toggle_pixbuf_renderer_render (GtkCellRenderer *cell,
- cairo_t *cr,
- GtkWidget *widget,
- const GdkRectangle *background_area,
- const GdkRectangle *cell_area,
- GtkCellRendererState flags)
+gd_toggle_pixbuf_renderer_snapshot (GtkCellRenderer *cell,
+ GtkSnapshot *snapshot,
+ GtkWidget *widget,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
+ GtkCellRendererState flags)
{
GdTogglePixbufRenderer *self = GD_TOGGLE_PIXBUF_RENDERER (cell);
gint xpad, ypad;
+ graphene_rect_t bounds;
+ cairo_t *cr;
- GTK_CELL_RENDERER_CLASS (gd_toggle_pixbuf_renderer_parent_class)->render
- (cell, cr, widget,
+ GTK_CELL_RENDERER_CLASS (gd_toggle_pixbuf_renderer_parent_class)->snapshot
+ (cell, snapshot, widget,
background_area, cell_area, flags);
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
+ bounds = GRAPHENE_RECT_INIT (cell_area->x, cell_area->y,
+ cell_area->width, cell_area->height);
+ cr = gtk_snapshot_append_cairo (snapshot, &bounds, "GdTogglePixbufRenderer Activity");
render_activity (self, cr, widget, cell_area, CHECK_ICON_SIZE, xpad, ypad);
+ cairo_destroy (cr);
+
+ cr = gtk_snapshot_append_cairo (snapshot, &bounds, "GdTogglePixbufRenderer Check");
render_check (self, cr, widget, cell_area, CHECK_ICON_SIZE, xpad, ypad);
+ cairo_destroy (cr);
}
static void
@@ -205,7 +214,7 @@ gd_toggle_pixbuf_renderer_class_init (GdTogglePixbufRendererClass *klass)
GObjectClass *oclass = G_OBJECT_CLASS (klass);
GtkCellRendererClass *crclass = GTK_CELL_RENDERER_CLASS (klass);
- crclass->render = gd_toggle_pixbuf_renderer_render;
+ crclass->snapshot = gd_toggle_pixbuf_renderer_snapshot;
crclass->get_size = gd_toggle_pixbuf_renderer_get_size;
oclass->get_property = gd_toggle_pixbuf_renderer_get_property;
oclass->set_property = gd_toggle_pixbuf_renderer_set_property;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]