gsk: Drop gsk_render_node_make_immutable, nodes are always immutable

This commit is contained in:
Alexander Larsson 2016-12-21 11:00:18 +01:00
parent 4ee45b76ca
commit 2d4b46f4f9
4 changed files with 3 additions and 153 deletions

View File

@ -616,7 +616,7 @@ gsk_renderer_unrealize (GskRenderer *renderer)
* using the given #GdkDrawingContext.
*
* The @renderer will acquire a reference on the #GskRenderNode tree while
* the rendering is in progress, and will make the tree immutable.
* the rendering is in progress.
*
* Since: 3.90
*/
@ -635,7 +635,6 @@ gsk_renderer_render (GskRenderer *renderer,
g_return_if_fail (context == priv->drawing_context);
priv->root_node = gsk_render_node_ref (root);
gsk_render_node_make_immutable (priv->root_node);
#ifdef G_ENABLE_DEBUG
gsk_profiler_reset (priv->profiler);

View File

@ -35,8 +35,8 @@
*
* Render nodes are meant to be transient; once they have been associated
* to a #GskRenderer it's safe to release any reference you have on them.
* Once a #GskRenderNode has been rendered, it is marked as immutable, and
* cannot be modified.
* All #GskRenderNodes are immutable, you can only specify their properties
* during construction.
*/
#include "config.h"
@ -68,8 +68,6 @@ G_DEFINE_BOXED_TYPE (GskRenderNode, gsk_render_node,
static void
gsk_render_node_finalize (GskRenderNode *self)
{
self->is_mutable = TRUE;
self->node_class->finalize (self);
g_clear_pointer (&self->name, g_free);
@ -100,8 +98,6 @@ gsk_render_node_new (const GskRenderNodeClass *node_class)
self->min_filter = GSK_SCALING_FILTER_NEAREST;
self->mag_filter = GSK_SCALING_FILTER_NEAREST;
self->is_mutable = TRUE;
return self;
}
@ -237,23 +233,6 @@ gsk_render_node_get_name (GskRenderNode *node)
return node->name;
}
/*< private >
* gsk_render_node_make_immutable:
* @node: a #GskRenderNode
*
* Marks @node, and all its children, as immutable.
*/
void
gsk_render_node_make_immutable (GskRenderNode *node)
{
if (!node->is_mutable)
return;
node->node_class->make_immutable (node);
node->is_mutable = FALSE;
}
/**
* gsk_render_node_draw:
* @node: a #GskRenderNode

View File

@ -41,11 +41,6 @@ gsk_color_node_finalize (GskRenderNode *node)
{
}
static void
gsk_color_node_make_immutable (GskRenderNode *node)
{
}
static void
gsk_color_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -74,7 +69,6 @@ static const GskRenderNodeClass GSK_COLOR_NODE_CLASS = {
sizeof (GskColorNode),
"GskColorNode",
gsk_color_node_finalize,
gsk_color_node_make_immutable,
gsk_color_node_draw,
gsk_color_node_get_bounds
};
@ -141,11 +135,6 @@ gsk_linear_gradient_node_finalize (GskRenderNode *node)
g_free (self->stops);
}
static void
gsk_linear_gradient_node_make_immutable (GskRenderNode *node)
{
}
static void
gsk_linear_gradient_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -193,7 +182,6 @@ static const GskRenderNodeClass GSK_LINEAR_GRADIENT_NODE_CLASS = {
sizeof (GskLinearGradientNode),
"GskLinearGradientNode",
gsk_linear_gradient_node_finalize,
gsk_linear_gradient_node_make_immutable,
gsk_linear_gradient_node_draw,
gsk_linear_gradient_node_get_bounds
};
@ -203,7 +191,6 @@ static const GskRenderNodeClass GSK_REPEATING_LINEAR_GRADIENT_NODE_CLASS = {
sizeof (GskLinearGradientNode),
"GskLinearGradientNode",
gsk_linear_gradient_node_finalize,
gsk_linear_gradient_node_make_immutable,
gsk_linear_gradient_node_draw,
gsk_linear_gradient_node_get_bounds
};
@ -290,11 +277,6 @@ gsk_border_node_finalize (GskRenderNode *node)
{
}
static void
gsk_border_node_make_immutable (GskRenderNode *node)
{
}
static void
gsk_border_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -392,7 +374,6 @@ static const GskRenderNodeClass GSK_BORDER_NODE_CLASS = {
sizeof (GskBorderNode),
"GskBorderNode",
gsk_border_node_finalize,
gsk_border_node_make_immutable,
gsk_border_node_draw,
gsk_border_node_get_bounds
};
@ -478,11 +459,6 @@ gsk_texture_node_finalize (GskRenderNode *node)
gsk_texture_unref (self->texture);
}
static void
gsk_texture_node_make_immutable (GskRenderNode *node)
{
}
static void
gsk_texture_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -521,7 +497,6 @@ static const GskRenderNodeClass GSK_TEXTURE_NODE_CLASS = {
sizeof (GskTextureNode),
"GskTextureNode",
gsk_texture_node_finalize,
gsk_texture_node_make_immutable,
gsk_texture_node_draw,
gsk_texture_node_get_bounds
};
@ -586,11 +561,6 @@ gsk_inset_shadow_node_finalize (GskRenderNode *node)
{
}
static void
gsk_inset_shadow_node_make_immutable (GskRenderNode *node)
{
}
static gboolean
has_empty_clip (cairo_t *cr)
{
@ -988,7 +958,6 @@ static const GskRenderNodeClass GSK_INSET_SHADOW_NODE_CLASS = {
sizeof (GskInsetShadowNode),
"GskInsetShadowNode",
gsk_inset_shadow_node_finalize,
gsk_inset_shadow_node_make_immutable,
gsk_inset_shadow_node_draw,
gsk_inset_shadow_node_get_bounds
};
@ -1055,11 +1024,6 @@ gsk_outset_shadow_node_finalize (GskRenderNode *node)
{
}
static void
gsk_outset_shadow_node_make_immutable (GskRenderNode *node)
{
}
static void
gsk_outset_shadow_get_extents (GskOutsetShadowNode *self,
float *top,
@ -1202,7 +1166,6 @@ static const GskRenderNodeClass GSK_OUTSET_SHADOW_NODE_CLASS = {
sizeof (GskOutsetShadowNode),
"GskOutsetShadowNode",
gsk_outset_shadow_node_finalize,
gsk_outset_shadow_node_make_immutable,
gsk_outset_shadow_node_draw,
gsk_outset_shadow_node_get_bounds
};
@ -1269,11 +1232,6 @@ gsk_cairo_node_finalize (GskRenderNode *node)
cairo_surface_destroy (self->surface);
}
static void
gsk_cairo_node_make_immutable (GskRenderNode *node)
{
}
static void
gsk_cairo_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -1301,7 +1259,6 @@ static const GskRenderNodeClass GSK_CAIRO_NODE_CLASS = {
sizeof (GskCairoNode),
"GskCairoNode",
gsk_cairo_node_finalize,
gsk_cairo_node_make_immutable,
gsk_cairo_node_draw,
gsk_cairo_node_get_bounds
};
@ -1374,7 +1331,6 @@ gsk_cairo_node_get_draw_context (GskRenderNode *node,
cairo_t *res;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_CAIRO_NODE), NULL);
g_return_val_if_fail (node->is_mutable, NULL);
g_return_val_if_fail (renderer == NULL || GSK_IS_RENDERER (renderer), NULL);
width = ceilf (self->bounds.size.width);
@ -1459,18 +1415,6 @@ gsk_container_node_finalize (GskRenderNode *node)
g_free (container->children);
}
static void
gsk_container_node_make_immutable (GskRenderNode *node)
{
GskContainerNode *container = (GskContainerNode *) node;
guint i;
for (i = 1; i < container->n_children; i++)
{
gsk_render_node_make_immutable (container->children[i]);
}
}
static void
gsk_container_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -1513,7 +1457,6 @@ static const GskRenderNodeClass GSK_CONTAINER_NODE_CLASS = {
sizeof (GskContainerNode),
"GskContainerNode",
gsk_container_node_finalize,
gsk_container_node_make_immutable,
gsk_container_node_draw,
gsk_container_node_get_bounds
};
@ -1600,14 +1543,6 @@ gsk_transform_node_finalize (GskRenderNode *node)
gsk_render_node_unref (self->child);
}
static void
gsk_transform_node_make_immutable (GskRenderNode *node)
{
GskTransformNode *self = (GskTransformNode *) node;
gsk_render_node_make_immutable (self->child);
}
static void
gsk_transform_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -1656,7 +1591,6 @@ static const GskRenderNodeClass GSK_TRANSFORM_NODE_CLASS = {
sizeof (GskTransformNode),
"GskTransformNode",
gsk_transform_node_finalize,
gsk_transform_node_make_immutable,
gsk_transform_node_draw,
gsk_transform_node_get_bounds
};
@ -1739,14 +1673,6 @@ gsk_opacity_node_finalize (GskRenderNode *node)
gsk_render_node_unref (self->child);
}
static void
gsk_opacity_node_make_immutable (GskRenderNode *node)
{
GskOpacityNode *self = (GskOpacityNode *) node;
gsk_render_node_make_immutable (self->child);
}
static void
gsk_opacity_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -1785,7 +1711,6 @@ static const GskRenderNodeClass GSK_OPACITY_NODE_CLASS = {
sizeof (GskOpacityNode),
"GskOpacityNode",
gsk_opacity_node_finalize,
gsk_opacity_node_make_immutable,
gsk_opacity_node_draw,
gsk_opacity_node_get_bounds
};
@ -1866,14 +1791,6 @@ gsk_clip_node_finalize (GskRenderNode *node)
gsk_render_node_unref (self->child);
}
static void
gsk_clip_node_make_immutable (GskRenderNode *node)
{
GskClipNode *self = (GskClipNode *) node;
gsk_render_node_make_immutable (self->child);
}
static void
gsk_clip_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -1909,7 +1826,6 @@ static const GskRenderNodeClass GSK_CLIP_NODE_CLASS = {
sizeof (GskClipNode),
"GskClipNode",
gsk_clip_node_finalize,
gsk_clip_node_make_immutable,
gsk_clip_node_draw,
gsk_clip_node_get_bounds
};
@ -1991,14 +1907,6 @@ gsk_rounded_clip_node_finalize (GskRenderNode *node)
gsk_render_node_unref (self->child);
}
static void
gsk_rounded_clip_node_make_immutable (GskRenderNode *node)
{
GskRoundedClipNode *self = (GskRoundedClipNode *) node;
gsk_render_node_make_immutable (self->child);
}
static void
gsk_rounded_clip_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -2032,7 +1940,6 @@ static const GskRenderNodeClass GSK_ROUNDED_CLIP_NODE_CLASS = {
sizeof (GskRoundedClipNode),
"GskRoundedClipNode",
gsk_rounded_clip_node_finalize,
gsk_rounded_clip_node_make_immutable,
gsk_rounded_clip_node_draw,
gsk_rounded_clip_node_get_bounds
};
@ -2118,14 +2025,6 @@ gsk_shadow_node_finalize (GskRenderNode *node)
g_free (self->shadows);
}
static void
gsk_shadow_node_make_immutable (GskRenderNode *node)
{
GskShadowNode *self = (GskShadowNode *) node;
gsk_render_node_make_immutable (self->child);
}
static void
gsk_shadow_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -2193,7 +2092,6 @@ static const GskRenderNodeClass GSK_SHADOW_NODE_CLASS = {
sizeof (GskShadowNode),
"GskShadowNode",
gsk_shadow_node_finalize,
gsk_shadow_node_make_immutable,
gsk_shadow_node_draw,
gsk_shadow_node_get_bounds
};
@ -2327,15 +2225,6 @@ gsk_blend_node_finalize (GskRenderNode *node)
gsk_render_node_unref (self->top);
}
static void
gsk_blend_node_make_immutable (GskRenderNode *node)
{
GskBlendNode *self = (GskBlendNode *) node;
gsk_render_node_make_immutable (self->bottom);
gsk_render_node_make_immutable (self->top);
}
static void
gsk_blend_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -2374,7 +2263,6 @@ static const GskRenderNodeClass GSK_BLEND_NODE_CLASS = {
sizeof (GskBlendNode),
"GskBlendNode",
gsk_blend_node_finalize,
gsk_blend_node_make_immutable,
gsk_blend_node_draw,
gsk_blend_node_get_bounds
};
@ -2463,15 +2351,6 @@ gsk_cross_fade_node_finalize (GskRenderNode *node)
gsk_render_node_unref (self->end);
}
static void
gsk_cross_fade_node_make_immutable (GskRenderNode *node)
{
GskCrossFadeNode *self = (GskCrossFadeNode *) node;
gsk_render_node_make_immutable (self->start);
gsk_render_node_make_immutable (self->end);
}
static void
gsk_cross_fade_node_draw (GskRenderNode *node,
cairo_t *cr)
@ -2510,7 +2389,6 @@ static const GskRenderNodeClass GSK_CROSS_FADE_NODE_CLASS = {
sizeof (GskCrossFadeNode),
"GskCrossFadeNode",
gsk_cross_fade_node_finalize,
gsk_cross_fade_node_make_immutable,
gsk_cross_fade_node_draw,
gsk_cross_fade_node_get_bounds
};

View File

@ -22,9 +22,6 @@ struct _GskRenderNode
/* Scaling filters */
GskScalingFilter min_filter;
GskScalingFilter mag_filter;
/* Bit fields; leave at the end */
gboolean is_mutable : 1;
};
struct _GskRenderNodeClass
@ -33,7 +30,6 @@ struct _GskRenderNodeClass
gsize struct_size;
const char *type_name;
void (* finalize) (GskRenderNode *node);
void (* make_immutable) (GskRenderNode *node);
void (* draw) (GskRenderNode *node,
cairo_t *cr);
void (* get_bounds) (GskRenderNode *node,
@ -42,8 +38,6 @@ struct _GskRenderNodeClass
GskRenderNode *gsk_render_node_new (const GskRenderNodeClass *node_class);
void gsk_render_node_make_immutable (GskRenderNode *node);
void gsk_render_node_get_bounds (GskRenderNode *node,
graphene_rect_t *frame);
double gsk_opacity_node_get_opacity (GskRenderNode *node);