gsk: Remove gsk_render_node_get_size()

In the brave new world of refactored render nodes, this function doesn't
really make any sense anymore. We could turn it into a vfunc, but I
don't think it's useful.

Especially because even in the brave old world, this function was
causing a vastl overallocation of nodes when the GL renderer needed render
targets.
This commit is contained in:
Benjamin Otte 2016-12-11 11:55:10 +01:00
parent d907f60843
commit 4d376c80f3
3 changed files with 3 additions and 37 deletions

View File

@ -800,28 +800,23 @@ gsk_gl_renderer_validate_tree (GskGLRenderer *self,
GskRenderNode *root, GskRenderNode *root,
const graphene_matrix_t *projection) const graphene_matrix_t *projection)
{ {
int n_nodes;
if (self->gl_context == NULL) if (self->gl_context == NULL)
{ {
GSK_NOTE (OPENGL, g_print ("No valid GL context associated to the renderer")); GSK_NOTE (OPENGL, g_print ("No valid GL context associated to the renderer"));
return FALSE; return FALSE;
} }
n_nodes = gsk_render_node_get_size (root);
gdk_gl_context_make_current (self->gl_context); gdk_gl_context_make_current (self->gl_context);
self->render_items = g_array_sized_new (FALSE, FALSE, sizeof (RenderItem), n_nodes); self->render_items = g_array_new (FALSE, FALSE, sizeof (RenderItem));
gsk_gl_driver_begin_frame (self->gl_driver); gsk_gl_driver_begin_frame (self->gl_driver);
GSK_NOTE (OPENGL, g_print ("RenderNode -> RenderItem\n")); GSK_NOTE (OPENGL, g_print ("RenderNode -> RenderItem\n"));
gsk_gl_renderer_add_render_item (self, projection, self->render_items, root, NULL); gsk_gl_renderer_add_render_item (self, projection, self->render_items, root, NULL);
GSK_NOTE (OPENGL, g_print ("Total render items: %d of max:%d\n", GSK_NOTE (OPENGL, g_print ("Total render items: %d\n",
self->render_items->len, self->render_items->len));
n_nodes));
gsk_gl_driver_end_frame (self->gl_driver); gsk_gl_driver_end_frame (self->gl_driver);

View File

@ -849,30 +849,3 @@ gsk_render_node_make_immutable (GskRenderNode *node)
node->is_mutable = FALSE; node->is_mutable = FALSE;
} }
/*< private >
* gsk_render_node_get_size:
* @root: a #GskRenderNode
*
* Computes the total number of children of @root.
*
* Returns: the size of the tree
*/
int
gsk_render_node_get_size (GskRenderNode *root)
{
GskRenderNode *child;
int res;
g_return_val_if_fail (GSK_IS_RENDER_NODE (root), 0);
res = 1;
for (child = gsk_render_node_get_first_child (root);
child != NULL;
child = gsk_render_node_get_next_sibling (child))
{
res += gsk_render_node_get_size (child);
}
return res;
}

View File

@ -89,8 +89,6 @@ void gsk_render_node_update_world_matrix (GskRenderNode *node,
void gsk_render_node_get_world_matrix (GskRenderNode *node, void gsk_render_node_get_world_matrix (GskRenderNode *node,
graphene_matrix_t *mv); graphene_matrix_t *mv);
int gsk_render_node_get_size (GskRenderNode *root);
G_END_DECLS G_END_DECLS
#endif /* __GSK_RENDER_NODE_PRIVATE_H__ */ #endif /* __GSK_RENDER_NODE_PRIVATE_H__ */