summaryrefslogtreecommitdiff
path: root/cogl/cogl-primitive.c
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2012-02-06 12:52:18 +0000
committerNeil Roberts <neil@linux.intel.com>2012-02-07 15:25:35 +0000
commit146803c191058330675d493822a331824ab3478a (patch)
tree4b2fd90c7757d0851061bf2df4f4a25ddee32248 /cogl/cogl-primitive.c
parent55427a18a611a0006da1ab874dec7a93e760b21b (diff)
downloadcogl-146803c191058330675d493822a331824ab3478a.tar.gz
Add cogl_primitive_copy()
This adds a public function to make a copy of a primitive. The copy is shallow which means it will share the same attributes and attribute buffers. This could be useful for code that wants to have multiple similar primitives with slightly modified properties. Reviewed-by: Robert Bragg <robert@linux.intel.com>
Diffstat (limited to 'cogl/cogl-primitive.c')
-rw-r--r--cogl/cogl-primitive.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/cogl/cogl-primitive.c b/cogl/cogl-primitive.c
index a88f1899..10983cd6 100644
--- a/cogl/cogl-primitive.c
+++ b/cogl/cogl-primitive.c
@@ -525,6 +525,22 @@ cogl_primitive_set_indices (CoglPrimitive *primitive,
}
CoglPrimitive *
+cogl_primitive_copy (CoglPrimitive *primitive)
+{
+ CoglPrimitive *copy;
+
+ copy = cogl_primitive_new_with_attributes (primitive->mode,
+ primitive->n_vertices,
+ primitive->attributes,
+ primitive->n_attributes);
+
+ cogl_primitive_set_indices (copy, primitive->indices, primitive->n_vertices);
+ cogl_primitive_set_first_vertex (copy, primitive->first_vertex);
+
+ return copy;
+}
+
+CoglPrimitive *
_cogl_primitive_immutable_ref (CoglPrimitive *primitive)
{
int i;