diff --git a/cogl/cogl/cogl-indices-private.h b/cogl/cogl/cogl-indices-private.h index b9760d58a..cc4adb42b 100644 --- a/cogl/cogl/cogl-indices-private.h +++ b/cogl/cogl/cogl-indices-private.h @@ -41,7 +41,6 @@ struct _CoglIndices GObject parent_instance; CoglIndexBuffer *buffer; - size_t offset; CoglIndicesType type; diff --git a/cogl/cogl/cogl-indices.c b/cogl/cogl/cogl-indices.c index 9d4ffa721..dc063798e 100644 --- a/cogl/cogl/cogl-indices.c +++ b/cogl/cogl/cogl-indices.c @@ -82,21 +82,6 @@ cogl_indices_type_get_size (CoglIndicesType type) g_return_val_if_reached (0); } -CoglIndices * -cogl_indices_new_for_buffer (CoglIndicesType type, - CoglIndexBuffer *buffer, - size_t offset) -{ - CoglIndices *indices = g_object_new (COGL_TYPE_INDICES, NULL); - - indices->buffer = g_object_ref (buffer); - indices->offset = offset; - - indices->type = type; - - return indices; -} - CoglIndices * cogl_indices_new (CoglContext *context, CoglIndicesType type, @@ -104,21 +89,19 @@ cogl_indices_new (CoglContext *context, int n_indices) { size_t buffer_bytes = cogl_indices_type_get_size (type) * n_indices; - CoglIndexBuffer *index_buffer = cogl_index_buffer_new (context, buffer_bytes); - CoglBuffer *buffer = COGL_BUFFER (index_buffer); + g_autoptr (CoglIndexBuffer) index_buffer = + cogl_index_buffer_new (context, buffer_bytes); CoglIndices *indices; - if (!cogl_buffer_set_data (buffer, + if (!cogl_buffer_set_data (COGL_BUFFER (index_buffer), 0, indices_data, buffer_bytes)) - { - g_object_unref (index_buffer); - return NULL; - } + return NULL; - indices = cogl_indices_new_for_buffer (type, index_buffer, 0); - g_object_unref (index_buffer); + indices = g_object_new (COGL_TYPE_INDICES, NULL); + indices->buffer = g_steal_pointer (&index_buffer); + indices->type = type; return indices; } @@ -137,14 +120,6 @@ cogl_indices_get_indices_type (CoglIndices *indices) return indices->type; } -size_t -cogl_indices_get_offset (CoglIndices *indices) -{ - g_return_val_if_fail (COGL_IS_INDICES (indices), 0); - - return indices->offset; -} - CoglIndices * cogl_context_get_rectangle_indices (CoglContext *ctx, int n_rectangles) diff --git a/cogl/cogl/cogl-indices.h b/cogl/cogl/cogl-indices.h index e9fdc916e..d9cb85ed5 100644 --- a/cogl/cogl/cogl-indices.h +++ b/cogl/cogl/cogl-indices.h @@ -114,11 +114,6 @@ cogl_indices_new (CoglContext *context, const void *indices_data, int n_indices); -COGL_EXPORT CoglIndices * -cogl_indices_new_for_buffer (CoglIndicesType type, - CoglIndexBuffer *buffer, - size_t offset); - /** * cogl_indices_get_buffer: * @@ -130,8 +125,4 @@ cogl_indices_get_buffer (CoglIndices *indices); COGL_EXPORT CoglIndicesType cogl_indices_get_indices_type (CoglIndices *indices); -COGL_EXPORT size_t -cogl_indices_get_offset (CoglIndices *indices); - - G_END_DECLS diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c index 1fb8cdf77..83bac4fa3 100644 --- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c +++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c @@ -348,7 +348,6 @@ cogl_gl_framebuffer_draw_indexed_attributes (CoglFramebufferDriver *driver, cogl_framebuffer_driver_get_framebuffer (driver); CoglBuffer *buffer; uint8_t *base; - size_t buffer_offset; size_t index_size; GLenum indices_gl_type = 0; @@ -364,7 +363,6 @@ cogl_gl_framebuffer_draw_indexed_attributes (CoglFramebufferDriver *driver, */ base = _cogl_buffer_gl_bind (buffer, COGL_BUFFER_BIND_TARGET_INDEX_BUFFER, NULL); - buffer_offset = cogl_indices_get_offset (indices); index_size = cogl_indices_type_get_size (cogl_indices_get_indices_type (indices)); switch (cogl_indices_get_indices_type (indices)) @@ -384,7 +382,7 @@ cogl_gl_framebuffer_draw_indexed_attributes (CoglFramebufferDriver *driver, glDrawElements ((GLenum)mode, n_vertices, indices_gl_type, - base + buffer_offset + index_size * first_vertex)); + base + index_size * first_vertex)); _cogl_buffer_gl_unbind (buffer); }