mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-11 13:10:07 +00:00
gsk: remove excessive type checking within GSK
Anything that includes gskrendernodeprivate.h will get an alternate form of ref/unref for render nodes which does not need to do type checking on the parameter. We can expect that things are correct within GTK itself and this saves excessive amounts of TypeNode conformities checking.
This commit is contained in:
parent
83376648d7
commit
eb646a8e8b
@ -287,15 +287,21 @@ gsk_render_node_alloc (GskRenderNodeType node_type)
|
||||
* Returns: (transfer full): the `GskRenderNode` with an additional reference
|
||||
*/
|
||||
GskRenderNode *
|
||||
gsk_render_node_ref (GskRenderNode *node)
|
||||
(gsk_render_node_ref) (GskRenderNode *node)
|
||||
{
|
||||
g_return_val_if_fail (GSK_IS_RENDER_NODE (node), NULL);
|
||||
|
||||
g_atomic_ref_count_inc (&node->ref_count);
|
||||
|
||||
return node;
|
||||
return _gsk_render_node_ref (node);
|
||||
}
|
||||
|
||||
void
|
||||
_gsk_render_node_unref (GskRenderNode *node)
|
||||
{
|
||||
if G_UNLIKELY (g_atomic_ref_count_dec (&node->ref_count))
|
||||
GSK_RENDER_NODE_GET_CLASS (node)->finalize (node);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gsk_render_node_unref:
|
||||
* @node: (transfer full): a `GskRenderNode`
|
||||
@ -306,12 +312,11 @@ gsk_render_node_ref (GskRenderNode *node)
|
||||
* freed.
|
||||
*/
|
||||
void
|
||||
gsk_render_node_unref (GskRenderNode *node)
|
||||
(gsk_render_node_unref) (GskRenderNode *node)
|
||||
{
|
||||
g_return_if_fail (GSK_IS_RENDER_NODE (node));
|
||||
|
||||
if (g_atomic_ref_count_dec (&node->ref_count))
|
||||
GSK_RENDER_NODE_GET_CLASS (node)->finalize (node);
|
||||
_gsk_render_node_unref (node);
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,6 +57,8 @@ GType gsk_render_node_type_register_static (const char
|
||||
|
||||
gpointer gsk_render_node_alloc (GskRenderNodeType node_type);
|
||||
|
||||
void _gsk_render_node_unref (GskRenderNode *node);
|
||||
|
||||
gboolean gsk_render_node_can_diff (const GskRenderNode *node1,
|
||||
const GskRenderNode *node2) G_GNUC_PURE;
|
||||
void gsk_render_node_diff (GskRenderNode *node1,
|
||||
@ -87,6 +89,15 @@ gboolean gsk_container_node_is_disjoint (const GskRenderNode
|
||||
|
||||
gboolean gsk_render_node_use_offscreen_for_opacity (const GskRenderNode *node);
|
||||
|
||||
#define gsk_render_node_ref(node) _gsk_render_node_ref(node)
|
||||
#define gsk_render_node_unref(node) _gsk_render_node_unref(node)
|
||||
|
||||
static inline GskRenderNode *
|
||||
_gsk_render_node_ref (GskRenderNode *node)
|
||||
{
|
||||
g_atomic_ref_count_inc (&node->ref_count);
|
||||
return node;
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user