[cogl/wip/wl-list] Use CoglList instead of _COGL_LIST_* for CoglNode
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/wl-list] Use CoglList instead of _COGL_LIST_* for CoglNode
- Date: Sun, 9 Jun 2013 10:23:18 +0000 (UTC)
commit 46be5293e1cc3bb8db260879dd59973093acc6fc
Author: Neil Roberts <neil linux intel com>
Date: Sun Jun 9 11:14:59 2013 +0100
Use CoglList instead of _COGL_LIST_* for CoglNode
This is part of ongoing work to replace the BSD embedded list
implementation with the one from Wayland.
This patch is a bit more controversial because it increases the size
of CoglPipeline and CoglPipelineLayer by one pointer in order to have
the redundant tail pointer for the list head. Normally we try to be
very careful about the size of the CoglPipeline struct so this patch
might not be worth using.
cogl/cogl-node-private.h | 8 +++-----
cogl/cogl-node.c | 10 +++++-----
cogl/cogl-pipeline-layer.c | 4 ++--
cogl/cogl-pipeline-private.h | 2 +-
cogl/cogl-pipeline.c | 4 ++--
5 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/cogl/cogl-node-private.h b/cogl/cogl-node-private.h
index f1b505c..ee2246c 100644
--- a/cogl/cogl-node-private.h
+++ b/cogl/cogl-node-private.h
@@ -29,12 +29,10 @@
#define __COGL_NODE_PRIVATE_H
#include "cogl-object-private.h"
-#include "cogl-queue.h"
+#include "cogl-list.h"
typedef struct _CoglNode CoglNode;
-COGL_LIST_HEAD (CoglNodeList, CoglNode);
-
/* Pipelines and layers represent their state in a tree structure where
* some of the state relating to a given pipeline or layer may actually
* be owned by one if is ancestors in the tree. We have a common data
@@ -49,10 +47,10 @@ struct _CoglNode
CoglNode *parent;
/* The list entry here contains pointers to the node's siblings */
- COGL_LIST_ENTRY (CoglNode) list_node;
+ CoglList link;
/* List of children */
- CoglNodeList children;
+ CoglList children;
/* TRUE if the node took a strong reference on its parent. Weak
* pipelines for instance don't take a reference on their parent. */
diff --git a/cogl/cogl-node.c b/cogl/cogl-node.c
index ab32e28..88bf991 100644
--- a/cogl/cogl-node.c
+++ b/cogl/cogl-node.c
@@ -36,7 +36,7 @@ void
_cogl_pipeline_node_init (CoglNode *node)
{
node->parent = NULL;
- COGL_LIST_INIT (&node->children);
+ _cogl_list_init (&node->children);
}
void
@@ -59,7 +59,7 @@ _cogl_pipeline_node_set_parent_real (CoglNode *node,
if (node->parent)
unparent (node);
- COGL_LIST_INSERT_HEAD (&parent->children, node, list_node);
+ _cogl_list_insert (&parent->children, &node->link);
node->parent = parent;
node->has_parent_reference = take_strong_reference;
@@ -80,9 +80,9 @@ _cogl_pipeline_node_unparent_real (CoglNode *node)
if (parent == NULL)
return;
- _COGL_RETURN_IF_FAIL (!COGL_LIST_EMPTY (&parent->children));
+ _COGL_RETURN_IF_FAIL (!_cogl_list_empty (&parent->children));
- COGL_LIST_REMOVE (node, list_node);
+ _cogl_list_remove (&node->link);
if (node->has_parent_reference)
cogl_object_unref (parent);
@@ -97,7 +97,7 @@ _cogl_pipeline_node_foreach_child (CoglNode *node,
{
CoglNode *child, *next;
- COGL_LIST_FOREACH_SAFE (child, &node->children, list_node, next)
+ _cogl_list_for_each_safe (child, next, &node->children, link)
callback (child, user_data);
}
diff --git a/cogl/cogl-pipeline-layer.c b/cogl/cogl-pipeline-layer.c
index bb77f6b..a401773 100644
--- a/cogl/cogl-pipeline-layer.c
+++ b/cogl/cogl-pipeline-layer.c
@@ -346,7 +346,7 @@ _cogl_pipeline_layer_pre_change_notify (CoglPipeline *required_owner,
/* Identify the case where the layer is new with no owner or
* dependants and so we don't need to do anything. */
- if (COGL_LIST_EMPTY (&COGL_NODE (layer)->children) &&
+ if (_cogl_list_empty (&COGL_NODE (layer)->children) &&
layer->owner == NULL)
goto init_layer_state;
@@ -368,7 +368,7 @@ _cogl_pipeline_layer_pre_change_notify (CoglPipeline *required_owner,
* they have dependants - either direct children, or another
* pipeline as an owner.
*/
- if (!COGL_LIST_EMPTY (&COGL_NODE (layer)->children) ||
+ if (!_cogl_list_empty (&COGL_NODE (layer)->children) ||
layer->owner != required_owner)
{
CoglPipelineLayer *new = _cogl_pipeline_layer_copy (layer);
diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h
index a185b3c..72917de 100644
--- a/cogl/cogl-pipeline-private.h
+++ b/cogl/cogl-pipeline-private.h
@@ -34,7 +34,7 @@
#include "cogl-matrix.h"
#include "cogl-object-private.h"
#include "cogl-profile.h"
-#include "cogl-queue.h"
+#include "cogl-list.h"
#include "cogl-boxed-value.h"
#include "cogl-pipeline-snippet-private.h"
#include "cogl-pipeline-state.h"
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index b9264ed..19a8a19 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -431,7 +431,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
destroy_weak_children_cb,
NULL);
- g_assert (COGL_LIST_EMPTY (&COGL_NODE (pipeline)->children));
+ g_assert (_cogl_list_empty (&COGL_NODE (pipeline)->children));
_cogl_pipeline_unparent (COGL_NODE (pipeline));
@@ -1212,7 +1212,7 @@ _cogl_pipeline_pre_change_notify (CoglPipeline *pipeline,
/* If there are still children remaining though we'll need to
* perform a copy-on-write and reparent the dependants as children
* of the copy. */
- if (!COGL_LIST_EMPTY (&COGL_NODE (pipeline)->children))
+ if (!_cogl_list_empty (&COGL_NODE (pipeline)->children))
{
CoglPipeline *new_authority;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]