From e2625f8649492feebff98dd79addad2d493940dd Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 12 Dec 2016 18:54:49 +0100 Subject: [PATCH] gsk: Remove GskRenderNode::parent ... and all related APIs. --- docs/reference/gsk/gsk4-sections.txt | 2 - gsk/gskglrenderer.c | 21 +------ gsk/gskrendernode.c | 93 ---------------------------- gsk/gskrendernode.h | 6 -- gsk/gskrendernodeprivate.h | 2 - 5 files changed, 3 insertions(+), 121 deletions(-) diff --git a/docs/reference/gsk/gsk4-sections.txt b/docs/reference/gsk/gsk4-sections.txt index 7d1f88421d..f2fc3c32b9 100644 --- a/docs/reference/gsk/gsk4-sections.txt +++ b/docs/reference/gsk/gsk4-sections.txt @@ -28,14 +28,12 @@ gsk_render_node_ref gsk_render_node_unref GskRenderNodeType gsk_render_node_get_node_type -gsk_render_node_get_parent gsk_render_node_get_first_child gsk_render_node_get_last_child gsk_render_node_get_next_sibling gsk_render_node_get_previous_sibling gsk_render_node_append_child gsk_render_node_get_n_children -gsk_render_node_contains gsk_render_node_set_transform gsk_render_node_set_opacity GskBlendMode diff --git a/gsk/gskglrenderer.c b/gsk/gskglrenderer.c index 654e5d1457..eb0eacda18 100644 --- a/gsk/gskglrenderer.c +++ b/gsk/gskglrenderer.c @@ -405,18 +405,6 @@ gsk_gl_renderer_update_frustum (GskGLRenderer *self, #define N_VERTICES 6 -static inline int -node_depth (GskRenderNode *node) -{ - int ret = 0; - while (node->parent) - { - ret++; - node = node->parent; - } - return ret; -} - static void render_item (GskGLRenderer *self, RenderItem *item) @@ -473,8 +461,7 @@ render_item (GskGLRenderer *self, /* Draw the quad */ GSK_NOTE2 (OPENGL, TRANSFORMS, - g_print ("%*sDrawing item <%s>[%p] (w:%g, h:%g) with opacity: %g blend mode: %d\n", - 2 * node_depth (item->node), "", + g_print ("Drawing item <%s>[%p] (w:%g, h:%g) with opacity: %g blend mode: %d\n", item->name, item, item->size.width, item->size.height, @@ -530,8 +517,7 @@ render_item (GskGLRenderer *self, /* Draw the quad */ GSK_NOTE2 (OPENGL, TRANSFORMS, - g_print ("%*sDrawing offscreen item <%s>[%p] (w:%g, h:%g) with opacity: %g\n", - 2 * node_depth (item->node), "", + g_print ("Drawing offscreen item <%s>[%p] (w:%g, h:%g) with opacity: %g\n", item->name, item, item->size.width, item->size.height, @@ -778,8 +764,7 @@ gsk_gl_renderer_add_render_item (GskGLRenderer *self, vertex_data); } - GSK_NOTE (OPENGL, g_print ("%*sAdding node <%s>[%p] to render items\n", - 2 * node_depth (node), "", + GSK_NOTE (OPENGL, g_print ("Adding node <%s>[%p] to render items\n", node->name != NULL ? node->name : "unnamed", node)); g_array_append_val (render_items, item); diff --git a/gsk/gskrendernode.c b/gsk/gskrendernode.c index e5d6c2db33..41a9101026 100644 --- a/gsk/gskrendernode.c +++ b/gsk/gskrendernode.c @@ -174,24 +174,6 @@ gsk_render_node_get_node_type (GskRenderNode *node) return node->node_class->node_type; } -/** - * gsk_render_node_get_parent: - * @node: a #GskRenderNode - * - * Returns the parent of the @node. - * - * Returns: (transfer none): the parent of the #GskRenderNode - * - * Since: 3.90 - */ -GskRenderNode * -gsk_render_node_get_parent (GskRenderNode *node) -{ - g_return_val_if_fail (GSK_IS_RENDER_NODE (node), NULL); - - return node->parent; -} - /** * gsk_render_node_get_first_child: * @node: a #GskRenderNode @@ -281,15 +263,6 @@ gsk_render_node_insert_child_internal (GskRenderNode *node, return; } - if (child->parent != NULL) - { - g_critical ("The render node of type '%s' already has a parent of type '%s'; " - "render nodes cannot be added to multiple parents.", - G_OBJECT_TYPE_NAME (child), - G_OBJECT_TYPE_NAME (node)); - return; - } - if (!node->is_mutable) { g_critical ("The render node of type '%s' is immutable.", @@ -301,7 +274,6 @@ gsk_render_node_insert_child_internal (GskRenderNode *node, gsk_render_node_ref (child); - child->parent = node; child->age = 0; node->n_children += 1; @@ -422,18 +394,9 @@ gsk_render_node_remove_child (GskRenderNode *node, g_return_val_if_fail (GSK_IS_RENDER_NODE (child), node); g_return_val_if_fail (node->is_mutable, node); - if (child->parent != node) - { - g_critical ("The render node of type '%s' is not a child of the render node of type '%s'", - G_OBJECT_TYPE_NAME (child), - G_OBJECT_TYPE_NAME (node)); - return node; - } - prev_sibling = child->prev_sibling; next_sibling = child->next_sibling; - child->parent = NULL; child->prev_sibling = NULL; child->next_sibling = NULL; child->age = 0; @@ -573,62 +536,6 @@ gsk_render_node_get_opacity (GskRenderNode *node) return node->opacity; } -/** - * gsk_render_node_contains: - * @node: a #GskRenderNode - * @descendant: a #GskRenderNode - * - * Checks whether @node contains @descendant. - * - * Returns: %TRUE if the #GskRenderNode contains the given - * descendant - * - * Since: 3.90 - */ -gboolean -gsk_render_node_contains (GskRenderNode *node, - GskRenderNode *descendant) -{ - GskRenderNode *tmp; - - g_return_val_if_fail (GSK_IS_RENDER_NODE (node), FALSE); - g_return_val_if_fail (GSK_IS_RENDER_NODE (descendant), FALSE); - - for (tmp = descendant; tmp != NULL; tmp = tmp->parent) - if (tmp == node) - return TRUE; - - return FALSE; -} - -/*< private > - * gsk_render_node_get_toplevel: - * @node: a #GskRenderNode - * - * Retrieves the top level #GskRenderNode without a parent. - * - * Returns: (transfer none): the top level #GskRenderNode - */ -GskRenderNode * -gsk_render_node_get_toplevel (GskRenderNode *node) -{ - GskRenderNode *parent; - - parent = node->parent; - if (parent == NULL) - return node; - - while (parent != NULL) - { - if (parent->parent == NULL) - return parent; - - parent = parent->parent; - } - - return NULL; -} - void gsk_render_node_set_scaling_filters (GskRenderNode *node, GskScalingFilter min_filter, diff --git a/gsk/gskrendernode.h b/gsk/gskrendernode.h index 6e2c49cfb4..abe6100b2e 100644 --- a/gsk/gskrendernode.h +++ b/gsk/gskrendernode.h @@ -57,8 +57,6 @@ cairo_t * gsk_cairo_node_get_draw_context (GskRenderNode GDK_AVAILABLE_IN_3_90 GskRenderNode * gsk_container_node_new (void); -GDK_AVAILABLE_IN_3_90 -GskRenderNode * gsk_render_node_get_parent (GskRenderNode *node); GDK_AVAILABLE_IN_3_90 GskRenderNode * gsk_render_node_get_first_child (GskRenderNode *node); GDK_AVAILABLE_IN_3_90 @@ -74,10 +72,6 @@ GskRenderNode * gsk_render_node_append_child (GskRenderNode * GDK_AVAILABLE_IN_3_90 guint gsk_render_node_get_n_children (GskRenderNode *node); -GDK_AVAILABLE_IN_3_90 -gboolean gsk_render_node_contains (GskRenderNode *node, - GskRenderNode *descendant); - GDK_AVAILABLE_IN_3_90 void gsk_render_node_set_transform (GskRenderNode *node, const graphene_matrix_t *transform); diff --git a/gsk/gskrendernodeprivate.h b/gsk/gskrendernodeprivate.h index db8d16f397..ca4a793e46 100644 --- a/gsk/gskrendernodeprivate.h +++ b/gsk/gskrendernodeprivate.h @@ -75,8 +75,6 @@ GskTexture *gsk_texture_node_get_texture (GskRenderNode *node); GskBlendMode gsk_render_node_get_blend_mode (GskRenderNode *node); -GskRenderNode *gsk_render_node_get_toplevel (GskRenderNode *node); - G_END_DECLS #endif /* __GSK_RENDER_NODE_PRIVATE_H__ */