From 8904f7cbe4525d0d458dbb9ad8c011113f13074a Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 16 Mar 2012 11:57:34 +0000 Subject: [PATCH] paint-nodes: Make part of the API internal At least for the time being, we only expose the parts of the API that we want to use internally and for new, out-of-tree Content implementations. The full PaintNode tree API will be made public in 1.12 once we branch master. --- clutter/clutter-paint-node-private.h | 50 +++++++++++++++++++++- clutter/clutter-paint-node.c | 11 ++++- clutter/clutter-paint-node.h | 15 ------- clutter/clutter-paint-nodes.c | 36 ++++++++-------- clutter/clutter-paint-nodes.h | 23 ---------- clutter/clutter.symbols | 11 ----- doc/reference/clutter/clutter-sections.txt | 18 -------- 7 files changed, 78 insertions(+), 86 deletions(-) diff --git a/clutter/clutter-paint-node-private.h b/clutter/clutter-paint-node-private.h index 8e45f34f5..c28fd5041 100644 --- a/clutter/clutter-paint-node-private.h +++ b/clutter/clutter-paint-node-private.h @@ -101,7 +101,7 @@ void _clutter_paint_operation_clip_path (const C void _clutter_paint_operation_paint_primitive (const ClutterPaintOperation *op); void _clutter_paint_node_init_types (void); -gpointer _clutter_paint_node_internal (GType gtype); +gpointer _clutter_paint_node_create (GType gtype); ClutterPaintNode * _clutter_root_node_new (CoglFramebuffer *framebuffer, const ClutterColor *clear_color, @@ -113,6 +113,54 @@ ClutterPaintNode * _clutter_dummy_node_new (void); void _clutter_paint_node_paint (ClutterPaintNode *root); void _clutter_paint_node_dump_tree (ClutterPaintNode *root); +G_GNUC_INTERNAL +void clutter_paint_node_remove_child (ClutterPaintNode *node, + ClutterPaintNode *child); +G_GNUC_INTERNAL +void clutter_paint_node_replace_child (ClutterPaintNode *node, + ClutterPaintNode *old_child, + ClutterPaintNode *new_child); +G_GNUC_INTERNAL +void clutter_paint_node_remove_all (ClutterPaintNode *node); + +G_GNUC_INTERNAL +guint clutter_paint_node_get_n_children (ClutterPaintNode *node); + +G_GNUC_INTERNAL +ClutterPaintNode * clutter_paint_node_get_first_child (ClutterPaintNode *node); +G_GNUC_INTERNAL +ClutterPaintNode * clutter_paint_node_get_previous_sibling (ClutterPaintNode *node); +G_GNUC_INTERNAL +ClutterPaintNode * clutter_paint_node_get_next_sibling (ClutterPaintNode *node); +G_GNUC_INTERNAL +ClutterPaintNode * clutter_paint_node_get_last_child (ClutterPaintNode *node); +G_GNUC_INTERNAL +ClutterPaintNode * clutter_paint_node_get_parent (ClutterPaintNode *node); + +#define CLUTTER_TYPE_LAYER_NODE (_clutter_layer_node_get_type ()) +#define CLUTTER_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode)) +#define CLUTTER_IS_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYER_NODE)) + +/* + * ClutterLayerNode: + * + * The ClutterLayerNode structure is an opaque + * type whose members cannot be directly accessed. + * + * Since: 1.10 + */ +typedef struct _ClutterLayerNode ClutterLayerNode; +typedef struct _ClutterLayerNodeClass ClutterLayerNodeClass; + +GType _clutter_layer_node_get_type (void) G_GNUC_CONST; + +ClutterPaintNode * _clutter_layer_node_new (const CoglMatrix *projection, + const cairo_rectangle_t *viewport, + float width, + float height, + guint8 opacity); + + G_END_DECLS #endif /* __CLUTTER_PAINT_NODE_PRIVATE_H__ */ diff --git a/clutter/clutter-paint-node.c b/clutter/clutter-paint-node.c index 0d0d63751..c71a74b77 100644 --- a/clutter/clutter-paint-node.c +++ b/clutter/clutter-paint-node.c @@ -1105,8 +1105,17 @@ _clutter_paint_node_dump_tree (ClutterPaintNode *node) #endif /* CLUTTER_ENABLE_DEBUG */ } +/*< private > + * _clutter_paint_node_create: + * @gtype: a #ClutterPaintNode type + * + * Creates a new #ClutterPaintNode instance using @gtype + * + * Return value: (transfer full): the newly created #ClutterPaintNode + * sub-class instance; use clutter_paint_node_unref() when done + */ gpointer -_clutter_paint_node_internal (GType gtype) +_clutter_paint_node_create (GType gtype) { g_return_val_if_fail (g_type_is_a (gtype, CLUTTER_TYPE_PAINT_NODE), NULL); diff --git a/clutter/clutter-paint-node.h b/clutter/clutter-paint-node.h index 46cc7d30a..2c95d256a 100644 --- a/clutter/clutter-paint-node.h +++ b/clutter/clutter-paint-node.h @@ -51,21 +51,6 @@ void clutter_paint_node_set_name (Clutter void clutter_paint_node_add_child (ClutterPaintNode *node, ClutterPaintNode *child); -void clutter_paint_node_remove_child (ClutterPaintNode *node, - ClutterPaintNode *child); -void clutter_paint_node_replace_child (ClutterPaintNode *node, - ClutterPaintNode *old_child, - ClutterPaintNode *new_child); -void clutter_paint_node_remove_all (ClutterPaintNode *node); - -guint clutter_paint_node_get_n_children (ClutterPaintNode *node); - -ClutterPaintNode * clutter_paint_node_get_first_child (ClutterPaintNode *node); -ClutterPaintNode * clutter_paint_node_get_previous_sibling (ClutterPaintNode *node); -ClutterPaintNode * clutter_paint_node_get_next_sibling (ClutterPaintNode *node); -ClutterPaintNode * clutter_paint_node_get_last_child (ClutterPaintNode *node); -ClutterPaintNode * clutter_paint_node_get_parent (ClutterPaintNode *node); - void clutter_paint_node_add_rectangle (ClutterPaintNode *node, const ClutterActorBox *rect); void clutter_paint_node_add_texture_rectangle (ClutterPaintNode *node, diff --git a/clutter/clutter-paint-nodes.c b/clutter/clutter-paint-nodes.c index 37663c379..be7a23166 100644 --- a/clutter/clutter-paint-nodes.c +++ b/clutter/clutter-paint-nodes.c @@ -165,7 +165,7 @@ _clutter_root_node_new (CoglFramebuffer *framebuffer, { ClutterRootNode *res; - res = _clutter_paint_node_internal (_clutter_root_node_get_type ()); + res = _clutter_paint_node_create (_clutter_root_node_get_type ()); cogl_color_init_from_4ub (&res->clear_color, clear_color->red, @@ -242,7 +242,7 @@ _clutter_transform_node_new (const CoglMatrix *modelview) { ClutterTransformNode *res; - res = _clutter_paint_node_internal (_clutter_transform_node_get_type ()); + res = _clutter_paint_node_create (_clutter_transform_node_get_type ()); if (modelview != NULL) res->modelview = *modelview; @@ -291,7 +291,7 @@ clutter_dummy_node_init (ClutterDummyNode *self) ClutterPaintNode * _clutter_dummy_node_new (void) { - return _clutter_paint_node_internal (_clutter_dummy_node_get_type ()); + return _clutter_paint_node_create (_clutter_dummy_node_get_type ()); } /* @@ -474,7 +474,7 @@ clutter_pipeline_node_new (CoglPipeline *pipeline) g_return_val_if_fail (pipeline == NULL || cogl_is_pipeline (pipeline), NULL); - res = _clutter_paint_node_internal (CLUTTER_TYPE_PIPELINE_NODE); + res = _clutter_paint_node_create (CLUTTER_TYPE_PIPELINE_NODE); if (pipeline != NULL) res->pipeline = cogl_object_ref (pipeline); @@ -546,7 +546,7 @@ clutter_color_node_new (const ClutterColor *color) { ClutterPipelineNode *cnode; - cnode = _clutter_paint_node_internal (CLUTTER_TYPE_COLOR_NODE); + cnode = _clutter_paint_node_create (CLUTTER_TYPE_COLOR_NODE); if (color != NULL) { @@ -658,7 +658,7 @@ clutter_texture_node_new (CoglTexture *texture, g_return_val_if_fail (cogl_is_texture (texture), NULL); - tnode = _clutter_paint_node_internal (CLUTTER_TYPE_TEXTURE_NODE); + tnode = _clutter_paint_node_create (CLUTTER_TYPE_TEXTURE_NODE); cogl_pipeline_set_layer_texture (tnode->pipeline, 0, texture); @@ -856,7 +856,7 @@ clutter_text_node_new (PangoLayout *layout, g_return_val_if_fail (layout == NULL || PANGO_IS_LAYOUT (layout), NULL); - res = _clutter_paint_node_internal (CLUTTER_TYPE_TEXT_NODE); + res = _clutter_paint_node_create (CLUTTER_TYPE_TEXT_NODE); if (layout != NULL) res->layout = g_object_ref (layout); @@ -991,13 +991,15 @@ clutter_clip_node_init (ClutterClipNode *self) ClutterPaintNode * clutter_clip_node_new (void) { - return _clutter_paint_node_internal (CLUTTER_TYPE_CLIP_NODE); + return _clutter_paint_node_create (CLUTTER_TYPE_CLIP_NODE); } /* - * ClutterLayerNode + * ClutterLayerNode (private) */ +#define clutter_layer_node_get_type _clutter_layer_node_get_type + struct _ClutterLayerNode { ClutterPaintNode parent_instance; @@ -1152,7 +1154,7 @@ clutter_layer_node_init (ClutterLayerNode *self) cogl_matrix_init_identity (&self->projection); } -/** +/* * clutter_layer_node_new: * @projection: the projection matrix to use to set up the layer * @viewport: (type cairo.Rectangle): the viewport to use to set up the layer @@ -1172,16 +1174,16 @@ clutter_layer_node_init (ClutterLayerNode *self) * Since: 1.10 */ ClutterPaintNode * -clutter_layer_node_new (const CoglMatrix *projection, - const cairo_rectangle_t *viewport, - float width, - float height, - guint8 opacity) +_clutter_layer_node_new (const CoglMatrix *projection, + const cairo_rectangle_t *viewport, + float width, + float height, + guint8 opacity) { ClutterLayerNode *res; CoglColor color; - res = _clutter_paint_node_internal (CLUTTER_TYPE_LAYER_NODE); + res = _clutter_paint_node_create (CLUTTER_TYPE_LAYER_NODE); res->projection = *projection; res->viewport = *viewport; @@ -1203,7 +1205,7 @@ clutter_layer_node_new (const CoglMatrix *projection, cogl_object_unref (res->texture); res->texture = NULL; - goto out;; + goto out; } cogl_color_init_from_4ub (&color, opacity, opacity, opacity, opacity); diff --git a/clutter/clutter-paint-nodes.h b/clutter/clutter-paint-nodes.h index 3eb2cf7f5..be40f565b 100644 --- a/clutter/clutter-paint-nodes.h +++ b/clutter/clutter-paint-nodes.h @@ -135,29 +135,6 @@ GType clutter_text_node_get_type (void) G_GNUC_CONST; ClutterPaintNode * clutter_text_node_new (PangoLayout *layout, const ClutterColor *color); -#define CLUTTER_TYPE_LAYER_NODE (clutter_layer_node_get_type ()) -#define CLUTTER_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode)) -#define CLUTTER_IS_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYER_NODE)) - -/** - * ClutterLayerNode: - * - * The ClutterLayerNode structure is an opaque - * type whose members cannot be directly accessed. - * - * Since: 1.10 - */ -typedef struct _ClutterLayerNode ClutterLayerNode; -typedef struct _ClutterLayerNodeClass ClutterLayerNodeClass; - -GType clutter_layer_node_get_type (void) G_GNUC_CONST; - -ClutterPaintNode * clutter_layer_node_new (const CoglMatrix *projection, - const cairo_rectangle_t *viewport, - float width, - float height, - guint8 opacity); - G_END_DECLS #endif /* __CLUTTER_PAINT_NODES_H__ */ diff --git a/clutter/clutter.symbols b/clutter/clutter.symbols index a52d8e0e4..558a2f6f9 100644 --- a/clutter/clutter.symbols +++ b/clutter/clutter.symbols @@ -792,8 +792,6 @@ clutter_knot_copy clutter_knot_equal clutter_knot_free clutter_knot_get_type -clutter_layer_node_get_type -clutter_layer_node_new clutter_layout_meta_get_manager clutter_layout_meta_get_type clutter_layout_manager_allocate @@ -907,17 +905,8 @@ clutter_paint_node_add_path clutter_paint_node_add_primitive clutter_paint_node_add_rectangle clutter_paint_node_add_texture_rectangle -clutter_paint_node_get_first_child -clutter_paint_node_get_last_child -clutter_paint_node_get_n_children -clutter_paint_node_get_next_sibling -clutter_paint_node_get_parent -clutter_paint_node_get_previous_sibling clutter_paint_node_get_type clutter_paint_node_ref -clutter_paint_node_remove_all -clutter_paint_node_remove_child -clutter_paint_node_replace_child clutter_paint_node_set_name clutter_paint_node_unref clutter_path_add_cairo_path diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt index eac4bdb11..6b5dc668d 100644 --- a/doc/reference/clutter/clutter-sections.txt +++ b/doc/reference/clutter/clutter-sections.txt @@ -3046,16 +3046,6 @@ clutter_paint_node_unref clutter_paint_node_set_name clutter_paint_node_add_child -clutter_paint_node_remove_child -clutter_paint_node_replace_child -clutter_paint_node_remove_all -clutter_paint_node_get_n_children - -clutter_paint_node_get_first_child -clutter_paint_node_get_next_sibling -clutter_paint_node_get_previous_sibling -clutter_paint_node_get_last_child -clutter_paint_node_get_parent clutter_paint_node_add_rectangle clutter_paint_node_add_texture_rectangle @@ -3097,36 +3087,28 @@ clutter_text_node_new ClutterClipNode ClutterClipNodeClass clutter_clip_node_new - -ClutterLayerNode -ClutterLayerNodeClass -clutter_layer_node_new CLUTTER_TYPE_COLOR_NODE CLUTTER_TYPE_TEXTURE_NODE CLUTTER_TYPE_PIPELINE_NODE CLUTTER_TYPE_TEXT_NODE CLUTTER_TYPE_CLIP_NODE -CLUTTER_TYPE_LAYER_NODE CLUTTER_COLOR_NODE CLUTTER_TEXTURE_NODE CLUTTER_PIPELINE_NODE CLUTTER_TEXT_NODE CLUTTER_CLIP_NODE -CLUTTER_LAYER_NODE CLUTTER_IS_COLOR_NODE CLUTTER_IS_TEXTURE_NODE CLUTTER_IS_PIPELINE_NODE CLUTTER_IS_TEXT_NODE CLUTTER_IS_CLIP_NODE -CLUTTER_IS_LAYER_NODE clutter_color_node_get_type clutter_texture_node_get_type clutter_pipeline_node_get_type clutter_text_node_get_type clutter_clip_node_get_type -clutter_layer_node_get_type