broadway: Rewrite textures in nodes to global

This commit is contained in:
Alexander Larsson 2017-11-21 20:01:57 +01:00
parent 54e7a8f0c0
commit fd0285de09

View File

@ -215,6 +215,34 @@ get_client_serial (BroadwayClient *client, guint32 daemon_serial)
return client_serial;
}
static int
rewrite_node_textures (BroadwayClient *client,
int len, guint32 data[], int pos)
{
guint32 type;
guint32 i, n_children;
g_assert (pos < len);
type = data[pos++];
switch (type) {
case BROADWAY_NODE_TEXTURE:
data[pos+4] = GPOINTER_TO_INT (g_hash_table_lookup (client->textures,
GINT_TO_POINTER (data[pos+4])));
pos += 5;
break;
case BROADWAY_NODE_CONTAINER:
n_children = data[pos++];
for (i = 0; i < n_children; i++)
pos = rewrite_node_textures (client, len, data, pos);
break;
default:
g_assert_not_reached ();
}
return pos;
}
static void
client_handle_request (BroadwayClient *client,
@ -287,6 +315,8 @@ client_handle_request (BroadwayClient *client,
gsize array_size = request->base.size - sizeof (BroadwayRequestSetNodes) + sizeof(guint32);
int n_data = array_size / sizeof(guint32);
rewrite_node_textures (client, n_data, request->set_nodes.data, 0);
broadway_server_window_set_nodes (server,
request->set_nodes.id,
n_data,