summaryrefslogtreecommitdiff
path: root/gsk
diff options
context:
space:
mode:
authorUmang Jain <mailumangjain@gmail.com>2017-10-05 02:32:02 +0530
committerUmang Jain <mailumangjain@gmail.com>2017-10-08 18:22:34 +0530
commit74f8fc80d302694c628a6539aa817ce28902034d (patch)
treef4ef8d22aebd0373db31e5a3d12f67c901c531af /gsk
parent6cafb62e9b76d0c7c6ff9e0acf03a5f7bc39fac0 (diff)
downloadgtk+-74f8fc80d302694c628a6539aa817ce28902034d.tar.gz
gsk: Fix serialization of cairo node
https://bugzilla.gnome.org/show_bug.cgi?id=788534
Diffstat (limited to 'gsk')
-rw-r--r--gsk/gskrendernodeimpl.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index d560d8a554..13fbd0024b 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -1746,9 +1746,31 @@ gsk_cairo_node_serialize (GskRenderNode *node)
}
else
{
- /* FIXME: implement! */
- g_assert_not_reached ();
- return NULL;
+ int width, height;
+ int stride, i;
+ guchar *mem_surface, *data;
+
+ width = cairo_image_surface_get_width (self->surface);
+ height = cairo_image_surface_get_height (self->surface);
+ stride = cairo_image_surface_get_stride (self->surface);
+ data = cairo_image_surface_get_data (self->surface);
+
+ mem_surface = (guchar *) g_malloc (width * height * 4);
+
+ for (i = 0; i < height; i++)
+ memcpy (mem_surface + i * width * 4, data + i * stride, width * 4);
+
+ return g_variant_new ("(dddduu@au)",
+ (double) node->bounds.origin.x, (double) node->bounds.origin.y,
+ (double) node->bounds.size.width, (double) node->bounds.size.height,
+ (guint32) width,
+ (guint32) height,
+ g_variant_new_fixed_array (G_VARIANT_TYPE ("u"),
+ mem_surface,
+ width * height,
+ sizeof (guint32)));
+
+ g_free (mem_surface);
}
}