[cogl/wip/neil/master-next: 8/9] Add a version of _cogl_pipeline_get_layer which does not create it
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/neil/master-next: 8/9] Add a version of _cogl_pipeline_get_layer which does not create it
- Date: Thu, 9 Feb 2012 20:51:25 +0000 (UTC)
commit 277b5dad06820b46541ebee336241803e55da91c
Author: Neil Roberts <neil linux intel com>
Date: Thu Feb 9 20:38:03 2012 +0000
Add a version of _cogl_pipeline_get_layer which does not create it
This adds _cogl_pipeline_get_layer_with_flags which takes a set of
flags to modify the behaviour. The only flag currently available is
one to disable creating the layer if the layer index does not already
exist.
cogl/cogl-pipeline-private.h | 13 +++++++++++--
cogl/cogl-pipeline.c | 7 ++++---
2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h
index 5e4f0ff..072ab74 100644
--- a/cogl/cogl-pipeline-private.h
+++ b/cogl/cogl-pipeline-private.h
@@ -665,9 +665,18 @@ _cogl_pipeline_prune_redundant_ancestry (CoglPipeline *pipeline);
void _cogl_pipeline_update_blend_enable (CoglPipeline *pipeline,
CoglPipelineState changes);
+typedef enum
+{
+ COGL_PIPELINE_GET_LAYER_NO_CREATE
+} CoglPipelineGetLayerFlags;
+
CoglPipelineLayer *
-_cogl_pipeline_get_layer (CoglPipeline *pipeline,
- int layer_index);
+_cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline,
+ int layer_index,
+ CoglPipelineGetLayerFlags flags);
+
+#define _cogl_pipeline_get_layer(p, l) \
+ _cogl_pipeline_get_layer_with_flags (p, l, 0)
gboolean
_cogl_is_pipeline_layer (void *object);
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index fa3b1e2..b94b16e 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -1707,8 +1707,9 @@ _cogl_pipeline_get_layer_info (CoglPipeline *pipeline,
}
CoglPipelineLayer *
-_cogl_pipeline_get_layer (CoglPipeline *pipeline,
- int layer_index)
+_cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline,
+ int layer_index,
+ CoglPipelineGetLayerFlags flags)
{
CoglPipeline *authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS);
@@ -1742,7 +1743,7 @@ _cogl_pipeline_get_layer (CoglPipeline *pipeline,
_cogl_pipeline_get_layer_info (authority, &layer_info);
- if (layer_info.layer)
+ if (layer_info.layer || (flags & COGL_PIPELINE_GET_LAYER_NO_CREATE))
return layer_info.layer;
ctx = _cogl_context_get_default ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]