summaryrefslogtreecommitdiff
path: root/cogl/cogl-indices.c
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2012-02-06 17:08:58 +0000
committerRobert Bragg <robert@linux.intel.com>2012-02-09 14:28:02 +0000
commit3ea6acc072d9f15fd651953f183d66a92a155ee0 (patch)
treed0540ecdeb02a1cc02d27cfd05013e5a9c34090d /cogl/cogl-indices.c
parent269878217f6b2bfdd2b59425f2a9d3e0b6ce4c42 (diff)
downloadcogl-3ea6acc072d9f15fd651953f183d66a92a155ee0.tar.gz
buffer: explicitly relate buffers to a context
All CoglBuffer constructors now take an explicit CoglContext constructor. This is part of the on going effort to adapt to Cogl API so it no longer depends on a global, default context. Reviewed-by: Neil Roberts <neil@linux.intel.com>
Diffstat (limited to 'cogl/cogl-indices.c')
-rw-r--r--cogl/cogl-indices.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/cogl/cogl-indices.c b/cogl/cogl-indices.c
index 686ef8ac..c99985ce 100644
--- a/cogl/cogl-indices.c
+++ b/cogl/cogl-indices.c
@@ -76,12 +76,13 @@ cogl_indices_new_for_buffer (CoglIndicesType type,
}
CoglIndices *
-cogl_indices_new (CoglIndicesType type,
+cogl_indices_new (CoglContext *context,
+ CoglIndicesType type,
const void *indices_data,
int n_indices)
{
size_t buffer_bytes = sizeof_indices_type (type) * n_indices;
- CoglIndexBuffer *index_buffer = cogl_index_buffer_new (buffer_bytes);
+ CoglIndexBuffer *index_buffer = cogl_index_buffer_new (context, buffer_bytes);
CoglBuffer *buffer = COGL_BUFFER (index_buffer);
CoglIndices *indices;
@@ -170,12 +171,10 @@ _cogl_indices_immutable_unref (CoglIndices *indices)
}
CoglIndices *
-cogl_get_rectangle_indices (int n_rectangles)
+cogl_get_rectangle_indices (CoglContext *ctx, int n_rectangles)
{
int n_indices = n_rectangles * 6;
- _COGL_GET_CONTEXT (ctx, NULL);
-
/* Check if the largest index required will fit in a byte array... */
if (n_indices <= 256 / 4 * 6)
{
@@ -198,7 +197,8 @@ cogl_get_rectangle_indices (int n_rectangles)
}
ctx->rectangle_byte_indices
- = cogl_indices_new (COGL_INDICES_TYPE_UNSIGNED_BYTE,
+ = cogl_indices_new (ctx,
+ COGL_INDICES_TYPE_UNSIGNED_BYTE,
byte_array,
256 / 4 * 6);
@@ -241,7 +241,8 @@ cogl_get_rectangle_indices (int n_rectangles)
}
ctx->rectangle_short_indices
- = cogl_indices_new (COGL_INDICES_TYPE_UNSIGNED_SHORT,
+ = cogl_indices_new (ctx,
+ COGL_INDICES_TYPE_UNSIGNED_SHORT,
short_array,
ctx->rectangle_short_indices_len);