diff --git a/cogl/cogl/cogl-indices-private.h b/cogl/cogl/cogl-indices-private.h index b3d923919..b9760d58a 100644 --- a/cogl/cogl/cogl-indices-private.h +++ b/cogl/cogl/cogl-indices-private.h @@ -46,3 +46,6 @@ struct _CoglIndices CoglIndicesType type; }; + +size_t +cogl_indices_type_get_size (CoglIndicesType type); diff --git a/cogl/cogl/cogl-indices.c b/cogl/cogl/cogl-indices.c index 1989d8af6..0bfd3a3b9 100644 --- a/cogl/cogl/cogl-indices.c +++ b/cogl/cogl/cogl-indices.c @@ -67,8 +67,8 @@ cogl_indices_class_init (CoglIndicesClass *class) object_class->dispose = cogl_indices_dispose; } -static size_t -sizeof_indices_type (CoglIndicesType type) +size_t +cogl_indices_type_get_size (CoglIndicesType type) { switch (type) { @@ -103,7 +103,7 @@ cogl_indices_new (CoglContext *context, const void *indices_data, int n_indices) { - size_t buffer_bytes = sizeof_indices_type (type) * 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); CoglIndices *indices; diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c index 36edc4cdb..8c80d9a25 100644 --- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c +++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c @@ -34,6 +34,7 @@ #include "cogl/cogl-context-private.h" #include "cogl/cogl-framebuffer-private.h" #include "cogl/cogl-framebuffer.h" +#include "cogl/cogl-indices-private.h" #include "cogl/cogl-offscreen-private.h" #include "cogl/cogl-texture-private.h" #include "cogl/driver/gl/cogl-util-gl-private.h" @@ -324,21 +325,6 @@ cogl_gl_framebuffer_draw_attributes (CoglFramebufferDriver *driver, glDrawArrays ((GLenum)mode, first_vertex, n_vertices)); } -static size_t -sizeof_index_type (CoglIndicesType type) -{ - switch (type) - { - case COGL_INDICES_TYPE_UNSIGNED_BYTE: - return 1; - case COGL_INDICES_TYPE_UNSIGNED_SHORT: - return 2; - case COGL_INDICES_TYPE_UNSIGNED_INT: - return 4; - } - g_return_val_if_reached (0); -} - static void cogl_gl_framebuffer_draw_indexed_attributes (CoglFramebufferDriver *driver, CoglPipeline *pipeline, @@ -371,7 +357,7 @@ 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 = sizeof_index_type (cogl_indices_get_indices_type (indices)); + index_size = cogl_indices_type_get_size (cogl_indices_get_indices_type (indices)); switch (cogl_indices_get_indices_type (indices)) {