summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2012-02-13 23:02:04 +0000
committerRobert Bragg <robert@linux.intel.com>2012-02-17 23:48:50 +0000
commitf9bf1805b5a35ebd531caba20ed57c175734046b (patch)
tree11d9751dc9ed4dc2eec8eb0b34101635c4b45462
parent7ee90233c87e8dc0e94db160a39f8d6fde4e2232 (diff)
downloadcogl-f9bf1805b5a35ebd531caba20ed57c175734046b.tar.gz
moves and renames _cogl_get_format_bpp
This moves _cogl_get_format_bpp from cogl-bitmap.c to cogl.c and renames it to _cogl_pixel_format_get_bytes_per_pixel. This makes it clearer that it doesn't return bits per pixel and makes the naming consistent with other cogl api. The prototype has been moved to cogl-private.h since it seems we should be aiming to get rid of cogl-internal.h at some point. The patch also adds a simple gtk-doc comment since we might want to make this api public.
-rw-r--r--cogl/cogl-atlas.c5
-rw-r--r--cogl/cogl-bitmap-fallback.c6
-rw-r--r--cogl/cogl-bitmap.c24
-rw-r--r--cogl/cogl-blit.c2
-rw-r--r--cogl/cogl-internal.h3
-rw-r--r--cogl/cogl-pixel-buffer.c4
-rw-r--r--cogl/cogl-private.h12
-rw-r--r--cogl/cogl-texture-2d-sliced.c6
-rw-r--r--cogl/cogl-texture-2d.c11
-rw-r--r--cogl/cogl-texture-3d.c10
-rw-r--r--cogl/cogl-texture-rectangle.c4
-rw-r--r--cogl/cogl-texture.c21
-rw-r--r--cogl/cogl.c23
-rw-r--r--cogl/driver/gl/cogl-texture-driver-gl.c11
-rw-r--r--cogl/driver/gles/cogl-texture-driver-gles.c12
15 files changed, 87 insertions, 67 deletions
diff --git a/cogl/cogl-atlas.c b/cogl/cogl-atlas.c
index 3b5ddab3..b6749b50 100644
--- a/cogl/cogl-atlas.c
+++ b/cogl/cogl-atlas.c
@@ -39,6 +39,7 @@
#include "cogl-debug.h"
#include "cogl-framebuffer-private.h"
#include "cogl-blit.h"
+#include "cogl-private.h"
#include <stdlib.h>
@@ -187,7 +188,7 @@ _cogl_atlas_get_initial_size (CoglPixelFormat format,
initial minimum size. If the format is only 1 byte per pixel we
can use 1024x1024, otherwise we'll assume it will take 4 bytes
per pixel and use 512x512. */
- if (_cogl_get_format_bpp (format) == 1)
+ if (_cogl_pixel_format_get_bytes_per_pixel (format) == 1)
size = 1024;
else
size = 512;
@@ -276,7 +277,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
{
guint8 *clear_data;
CoglBitmap *clear_bmp;
- int bpp = _cogl_get_format_bpp (atlas->texture_format);
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (atlas->texture_format);
/* Create a buffer of zeroes to initially clear the texture */
clear_data = g_malloc0 (width * height * bpp);
diff --git a/cogl/cogl-bitmap-fallback.c b/cogl/cogl-bitmap-fallback.c
index 4478c432..1b5b8ca1 100644
--- a/cogl/cogl-bitmap-fallback.c
+++ b/cogl/cogl-bitmap-fallback.c
@@ -26,7 +26,7 @@
#endif
#include "cogl.h"
-#include "cogl-internal.h"
+#include "cogl-private.h"
#include "cogl-bitmap-private.h"
#include <string.h>
@@ -367,8 +367,8 @@ _cogl_bitmap_fallback_convert (CoglBitmap *src_bmp,
if (src_data == NULL)
return NULL;
- src_bpp = _cogl_get_format_bpp (src_format);
- dst_bpp = _cogl_get_format_bpp (dst_format);
+ src_bpp = _cogl_pixel_format_get_bytes_per_pixel (src_format);
+ dst_bpp = _cogl_pixel_format_get_bytes_per_pixel (dst_format);
/* Initialize destination bitmap */
dst_rowstride = sizeof(guint8) * dst_bpp * width;
diff --git a/cogl/cogl-bitmap.c b/cogl/cogl-bitmap.c
index a109d03b..84fd7ac7 100644
--- a/cogl/cogl-bitmap.c
+++ b/cogl/cogl-bitmap.c
@@ -28,7 +28,7 @@
#include "cogl.h"
#include "cogl-util.h"
#include "cogl-debug.h"
-#include "cogl-internal.h"
+#include "cogl-private.h"
#include "cogl-bitmap-private.h"
#include "cogl-buffer-private.h"
@@ -80,24 +80,6 @@ _cogl_bitmap_free (CoglBitmap *bmp)
g_slice_free (CoglBitmap, bmp);
}
-int
-_cogl_get_format_bpp (CoglPixelFormat format)
-{
- int bpp_lut[] = {
- 0, /* invalid */
- 1, /* A_8 */
- 3, /* 888 */
- 4, /* 8888 */
- 2, /* 565 */
- 2, /* 4444 */
- 2, /* 5551 */
- 2, /* YUV */
- 1 /* G_8 */
- };
-
- return bpp_lut [format & COGL_UNORDERED_MASK];
-}
-
gboolean
_cogl_bitmap_convert_premult_status (CoglBitmap *bmp,
CoglPixelFormat dst_format)
@@ -187,7 +169,7 @@ _cogl_bitmap_copy (CoglBitmap *src_bmp)
{
CoglBitmap *dst_bmp;
CoglPixelFormat src_format = _cogl_bitmap_get_format (src_bmp);
- int bpp = _cogl_get_format_bpp (src_format);
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (src_format);
int width = _cogl_bitmap_get_width (src_bmp);
int height = _cogl_bitmap_get_height (src_bmp);
int dst_rowstride = width * bpp;
@@ -228,7 +210,7 @@ _cogl_bitmap_copy_subregion (CoglBitmap *src,
/* Intended only for fast copies when format is equal! */
g_assert (src->format == dst->format);
- bpp = _cogl_get_format_bpp (src->format);
+ bpp = _cogl_pixel_format_get_bytes_per_pixel (src->format);
if ((srcdata = _cogl_bitmap_map (src, COGL_BUFFER_ACCESS_READ, 0)))
{
diff --git a/cogl/cogl-blit.c b/cogl/cogl-blit.c
index 2ab14455..dedfc286 100644
--- a/cogl/cogl-blit.c
+++ b/cogl/cogl-blit.c
@@ -267,7 +267,7 @@ static gboolean
_cogl_blit_get_tex_data_begin (CoglBlitData *data)
{
data->format = cogl_texture_get_format (data->src_tex);
- data->bpp = _cogl_get_format_bpp (data->format);
+ data->bpp = _cogl_pixel_format_get_bytes_per_pixel (data->format);
data->image_data = g_malloc (data->bpp * data->src_width *
data->src_height);
diff --git a/cogl/cogl-internal.h b/cogl/cogl-internal.h
index 6d001375..417ec709 100644
--- a/cogl/cogl-internal.h
+++ b/cogl/cogl-internal.h
@@ -70,9 +70,6 @@ cogl_gl_error_to_string (GLenum error_code);
#define COGL_ENABLE_VERTEX_ARRAY (1<<2)
#define COGL_ENABLE_COLOR_ARRAY (1<<3)
-int
-_cogl_get_format_bpp (CoglPixelFormat format);
-
void
_cogl_enable (unsigned long flags);
diff --git a/cogl/cogl-pixel-buffer.c b/cogl/cogl-pixel-buffer.c
index 84f948f2..bb8abad3 100644
--- a/cogl/cogl-pixel-buffer.c
+++ b/cogl/cogl-pixel-buffer.c
@@ -39,7 +39,7 @@
#include <glib.h>
#include "cogl.h"
-#include "cogl-internal.h"
+#include "cogl-private.h"
#include "cogl-util.h"
#include "cogl-context-private.h"
#include "cogl-object.h"
@@ -109,7 +109,7 @@ cogl_pixel_buffer_new_with_size (CoglContext *context,
/* for now we fallback to cogl_pixel_buffer_new, later, we could ask
* libdrm a tiled buffer for instance */
- stride = width * _cogl_get_format_bpp (format);
+ stride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
if (rowstride)
*rowstride = stride;
diff --git a/cogl/cogl-private.h b/cogl/cogl-private.h
index 911356d5..b4ff4205 100644
--- a/cogl/cogl-private.h
+++ b/cogl/cogl-private.h
@@ -63,6 +63,18 @@ _cogl_push_source (CoglPipeline *pipeline, gboolean enable_legacy);
gboolean
_cogl_get_enable_legacy_state (void);
+/*
+ * _cogl_pixel_format_get_bytes_per_pixel:
+ * @format: a #CoglPixelFormat
+ *
+ * Queries how many bytes a pixel of the given @format takes.
+ *
+ * Return value: The number of bytes taken for a pixel of the given
+ * @format.
+ */
+int
+_cogl_pixel_format_get_bytes_per_pixel (CoglPixelFormat format);
+
G_END_DECLS
#endif /* __COGL_PRIVATE_H__ */
diff --git a/cogl/cogl-texture-2d-sliced.c b/cogl/cogl-texture-2d-sliced.c
index 7220bf24..2e6eaf0f 100644
--- a/cogl/cogl-texture-2d-sliced.c
+++ b/cogl/cogl-texture-2d-sliced.c
@@ -32,7 +32,7 @@
#include "cogl.h"
#include "cogl-debug.h"
-#include "cogl-internal.h"
+#include "cogl-private.h"
#include "cogl-util.h"
#include "cogl-bitmap.h"
#include "cogl-bitmap-private.h"
@@ -146,7 +146,7 @@ _cogl_texture_2d_sliced_allocate_waste_buffer (CoglTexture2DSliced *tex_2ds,
tex_2ds->slice_y_spans->len - 1);
if (last_x_span->waste > 0 || last_y_span->waste > 0)
{
- int bpp = _cogl_get_format_bpp (format);
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
CoglSpan *first_x_span
= &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
CoglSpan *first_y_span
@@ -190,7 +190,7 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds,
{
int bmp_rowstride = _cogl_bitmap_get_rowstride (source_bmp);
CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
- int bpp = _cogl_get_format_bpp (source_format);
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
guint8 *bmp_data;
const guint8 *src;
guint8 *dst;
diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c
index 89bf63da..fef456b9 100644
--- a/cogl/cogl-texture-2d.c
+++ b/cogl/cogl-texture-2d.c
@@ -29,7 +29,7 @@
#endif
#include "cogl.h"
-#include "cogl-internal.h"
+#include "cogl-private.h"
#include "cogl-util.h"
#include "cogl-texture-private.h"
#include "cogl-texture-2d-private.h"
@@ -268,10 +268,11 @@ _cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
(data = _cogl_bitmap_map (dst_bmp,
COGL_BUFFER_ACCESS_READ, 0)))
{
+ CoglPixelFormat format = _cogl_bitmap_get_format (dst_bmp);
tex_2d->first_pixel.gl_format = gl_format;
tex_2d->first_pixel.gl_type = gl_type;
memcpy (tex_2d->first_pixel.data, data,
- _cogl_get_format_bpp (_cogl_bitmap_get_format (dst_bmp)));
+ _cogl_pixel_format_get_bytes_per_pixel (format));
_cogl_bitmap_unmap (dst_bmp);
}
@@ -310,7 +311,7 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
/* Rowstride from width if not given */
if (rowstride == 0)
- rowstride = width * _cogl_get_format_bpp (format);
+ rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
/* Wrap the data into a bitmap */
bmp = _cogl_bitmap_new_from_data ((guint8 *)data,
@@ -770,7 +771,7 @@ _cogl_texture_2d_set_region (CoglTexture *tex,
(data = _cogl_bitmap_map (bmp, COGL_BUFFER_ACCESS_READ, 0)))
{
CoglPixelFormat bpp =
- _cogl_get_format_bpp (_cogl_bitmap_get_format (bmp));
+ _cogl_pixel_format_get_bytes_per_pixel (_cogl_bitmap_get_format (bmp));
tex_2d->first_pixel.gl_format = gl_format;
tex_2d->first_pixel.gl_type = gl_type;
memcpy (tex_2d->first_pixel.data,
@@ -811,7 +812,7 @@ _cogl_texture_2d_get_data (CoglTexture *tex,
_COGL_GET_CONTEXT (ctx, FALSE);
- bpp = _cogl_get_format_bpp (format);
+ bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
ctx->texture_driver->pixel_format_to_gl (format,
NULL, /* internal format */
diff --git a/cogl/cogl-texture-3d.c b/cogl/cogl-texture-3d.c
index f332b68f..05ea35ce 100644
--- a/cogl/cogl-texture-3d.c
+++ b/cogl/cogl-texture-3d.c
@@ -27,7 +27,7 @@
#endif
#include "cogl.h"
-#include "cogl-internal.h"
+#include "cogl-private.h"
#include "cogl-util.h"
#include "cogl-texture-private.h"
#include "cogl-texture-3d-private.h"
@@ -287,10 +287,11 @@ _cogl_texture_3d_new_from_bitmap (CoglBitmap *bmp,
(data = _cogl_bitmap_map (dst_bmp,
COGL_BUFFER_ACCESS_READ, 0)))
{
+ CoglPixelFormat format = _cogl_bitmap_get_format (dst_bmp);
tex_3d->first_pixel.gl_format = gl_format;
tex_3d->first_pixel.gl_type = gl_type;
memcpy (tex_3d->first_pixel.data, data,
- _cogl_get_format_bpp (_cogl_bitmap_get_format (dst_bmp)));
+ _cogl_pixel_format_get_bytes_per_pixel (format));
_cogl_bitmap_unmap (dst_bmp);
}
@@ -340,7 +341,7 @@ cogl_texture_3d_new_from_data (unsigned int width,
/* Rowstride from width if not given */
if (rowstride == 0)
- rowstride = width * _cogl_get_format_bpp (format);
+ rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
/* Image stride from height and rowstride if not given */
if (image_stride == 0)
image_stride = height * rowstride;
@@ -355,7 +356,8 @@ cogl_texture_3d_new_from_data (unsigned int width,
if (image_stride % rowstride != 0)
{
int z, y;
- int bmp_rowstride = _cogl_get_format_bpp (format) * width;
+ int bmp_rowstride =
+ _cogl_pixel_format_get_bytes_per_pixel (format) * width;
guint8 *bmp_data = g_malloc (bmp_rowstride * height * depth);
bitmap = _cogl_bitmap_new_from_data (bmp_data,
diff --git a/cogl/cogl-texture-rectangle.c b/cogl/cogl-texture-rectangle.c
index 556b718e..88bc9f12 100644
--- a/cogl/cogl-texture-rectangle.c
+++ b/cogl/cogl-texture-rectangle.c
@@ -29,7 +29,7 @@
#endif
#include "cogl.h"
-#include "cogl-internal.h"
+#include "cogl-private.h"
#include "cogl-util.h"
#include "cogl-texture-private.h"
#include "cogl-texture-rectangle-private.h"
@@ -531,7 +531,7 @@ _cogl_texture_rectangle_get_data (CoglTexture *tex,
_COGL_GET_CONTEXT (ctx, FALSE);
- bpp = _cogl_get_format_bpp (format);
+ bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
ctx->texture_driver->pixel_format_to_gl (format,
NULL, /* internal format */
diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c
index 6f6f9630..bac03b50 100644
--- a/cogl/cogl-texture.c
+++ b/cogl/cogl-texture.c
@@ -342,7 +342,7 @@ cogl_texture_new_from_data (unsigned int width,
/* Rowstride from width if not given */
if (rowstride == 0)
- rowstride = width * _cogl_get_format_bpp (format);
+ rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
/* Wrap the data into a bitmap */
bmp = _cogl_bitmap_new_from_data ((guint8 *) data,
@@ -529,7 +529,7 @@ cogl_texture_new_from_buffer_EXP (CoglPixelBuffer *buffer,
if (rowstride == 0)
rowstride = pixel_buffer->stride;
if (rowstride == 0)
- rowstride = width * _cogl_get_format_bpp (format);
+ rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
/* use the CoglBuffer height and width as last resort */
if (width == 0)
@@ -579,12 +579,13 @@ cogl_texture_get_format (CoglTexture *texture)
unsigned int
cogl_texture_get_rowstride (CoglTexture *texture)
{
+ CoglPixelFormat format = cogl_texture_get_format (texture);
/* FIXME: This function should go away. It previously just returned
the rowstride that was used to upload the data as far as I can
tell. This is not helpful */
/* Just guess at a suitable rowstride */
- return (_cogl_get_format_bpp (cogl_texture_get_format (texture))
+ return (_cogl_pixel_format_get_bytes_per_pixel (format)
* cogl_texture_get_width (texture));
}
@@ -732,7 +733,7 @@ cogl_texture_set_region (CoglTexture *texture,
/* Rowstride from width if none specified */
if (rowstride == 0)
- rowstride = _cogl_get_format_bpp (format) * width;
+ rowstride = _cogl_pixel_format_get_bytes_per_pixel (format) * width;
/* Init source bitmap */
source_bmp = _cogl_bitmap_new_from_data ((guint8 *) data,
@@ -781,7 +782,7 @@ do_texture_draw_and_read (CoglTexture *texture,
CoglBitmap *rect_bmp;
unsigned int tex_width, tex_height;
- bpp = _cogl_get_format_bpp (COGL_PIXEL_FORMAT_RGBA_8888);
+ bpp = _cogl_pixel_format_get_bytes_per_pixel (COGL_PIXEL_FORMAT_RGBA_8888);
tex_width = cogl_texture_get_width (texture);
tex_height = cogl_texture_get_height (texture);
@@ -885,7 +886,7 @@ _cogl_texture_draw_and_read (CoglTexture *texture,
_COGL_GET_CONTEXT (ctx, FALSE);
- bpp = _cogl_get_format_bpp (COGL_PIXEL_FORMAT_RGBA_8888);
+ bpp = _cogl_pixel_format_get_bytes_per_pixel (COGL_PIXEL_FORMAT_RGBA_8888);
framebuffer = cogl_get_draw_framebuffer ();
/* Viewport needs to have some size and be inside the window for this */
@@ -1070,7 +1071,7 @@ get_texture_bits_via_copy (CoglTexture *texture,
full_tex_width = cogl_texture_get_width (texture);
full_tex_height = cogl_texture_get_height (texture);
- bpp = _cogl_get_format_bpp (dst_format);
+ bpp = _cogl_pixel_format_get_bytes_per_pixel (dst_format);
full_rowstride = bpp * full_tex_width;
full_bits = g_malloc (full_rowstride * full_tex_height);
@@ -1116,7 +1117,7 @@ texture_get_cb (CoglTexture *texture,
{
CoglTextureGetData *tg_data = user_data;
CoglPixelFormat format = _cogl_bitmap_get_format (tg_data->target_bmp);
- int bpp = _cogl_get_format_bpp (format);
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
unsigned int rowstride = _cogl_bitmap_get_rowstride (tg_data->target_bmp);
int subtexture_width = cogl_texture_get_width (texture);
int subtexture_height = cogl_texture_get_height (texture);
@@ -1206,7 +1207,7 @@ cogl_texture_get_data (CoglTexture *texture,
tex_height = cogl_texture_get_height (texture);
/* Rowstride from texture width if none specified */
- bpp = _cogl_get_format_bpp (format);
+ bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
if (rowstride == 0)
rowstride = tex_width * bpp;
@@ -1219,7 +1220,7 @@ cogl_texture_get_data (CoglTexture *texture,
ctx->texture_driver->find_best_gl_get_data_format (format,
&closest_gl_format,
&closest_gl_type);
- closest_bpp = _cogl_get_format_bpp (closest_format);
+ closest_bpp = _cogl_pixel_format_get_bytes_per_pixel (closest_format);
/* Is the requested format supported? */
if (closest_format == format)
diff --git a/cogl/cogl.c b/cogl/cogl.c
index cba3de7a..26870d0c 100644
--- a/cogl/cogl.c
+++ b/cogl/cogl.c
@@ -435,7 +435,7 @@ _cogl_read_pixels_with_rowstride (int x,
y = framebuffer_height - y - height;
/* Initialise the CoglBitmap */
- bpp = _cogl_get_format_bpp (format);
+ bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
bmp_format = format;
if ((format & COGL_A_BIT))
@@ -573,10 +573,11 @@ cogl_read_pixels (int x,
CoglPixelFormat format,
guint8 *pixels)
{
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
_cogl_read_pixels_with_rowstride (x, y, width, height,
source, format, pixels,
/* rowstride */
- _cogl_get_format_bpp (format) * width);
+ bpp * width);
}
void
@@ -1004,3 +1005,21 @@ _cogl_init (void)
g_once_init_leave (&init_status, 1);
}
}
+
+int
+_cogl_pixel_format_get_bytes_per_pixel (CoglPixelFormat format)
+{
+ int bpp_lut[] = {
+ 0, /* invalid */
+ 1, /* A_8 */
+ 3, /* 888 */
+ 4, /* 8888 */
+ 2, /* 565 */
+ 2, /* 4444 */
+ 2, /* 5551 */
+ 2, /* YUV */
+ 1 /* G_8 */
+ };
+
+ return bpp_lut [format & 0xf];
+}
diff --git a/cogl/driver/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/cogl-texture-driver-gl.c
index 6ab1b3e3..deda4c6c 100644
--- a/cogl/driver/gl/cogl-texture-driver-gl.c
+++ b/cogl/driver/gl/cogl-texture-driver-gl.c
@@ -31,7 +31,7 @@
#endif
#include "cogl.h"
-#include "cogl-internal.h"
+#include "cogl-private.h"
#include "cogl-util.h"
#include "cogl-bitmap.h"
#include "cogl-bitmap-private.h"
@@ -158,7 +158,8 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target,
GLuint source_gl_type)
{
guint8 *data;
- int bpp = _cogl_get_format_bpp (_cogl_bitmap_get_format (source_bmp));
+ CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
@@ -193,7 +194,8 @@ _cogl_texture_driver_upload_to_gl (GLenum gl_target,
GLuint source_gl_type)
{
guint8 *data;
- int bpp = _cogl_get_format_bpp (_cogl_bitmap_get_format (source_bmp));
+ CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
@@ -229,7 +231,8 @@ _cogl_texture_driver_upload_to_gl_3d (GLenum gl_target,
GLuint source_gl_type)
{
guint8 *data;
- int bpp = _cogl_get_format_bpp (_cogl_bitmap_get_format (source_bmp));
+ CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
diff --git a/cogl/driver/gles/cogl-texture-driver-gles.c b/cogl/driver/gles/cogl-texture-driver-gles.c
index 5123993b..bf80012e 100644
--- a/cogl/driver/gles/cogl-texture-driver-gles.c
+++ b/cogl/driver/gles/cogl-texture-driver-gles.c
@@ -31,7 +31,7 @@
#endif
#include "cogl.h"
-#include "cogl-internal.h"
+#include "cogl-private.h"
#include "cogl-util.h"
#include "cogl-bitmap.h"
#include "cogl-bitmap-private.h"
@@ -102,7 +102,7 @@ static CoglBitmap *
prepare_bitmap_alignment_for_upload (CoglBitmap *src_bmp)
{
CoglPixelFormat format = _cogl_bitmap_get_format (src_bmp);
- int bpp = _cogl_get_format_bpp (format);
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
int src_rowstride = _cogl_bitmap_get_rowstride (src_bmp);
int width = _cogl_bitmap_get_width (src_bmp);
int alignment = 1;
@@ -140,7 +140,7 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target,
{
guint8 *data;
CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
- int bpp = _cogl_get_format_bpp (source_format);
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
CoglBitmap *slice_bmp;
int rowstride;
@@ -201,7 +201,8 @@ _cogl_texture_driver_upload_to_gl (GLenum gl_target,
GLuint source_gl_format,
GLuint source_gl_type)
{
- int bpp = _cogl_get_format_bpp (_cogl_bitmap_get_format (source_bmp));
+ CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
int rowstride;
int bmp_width = _cogl_bitmap_get_width (source_bmp);
int bmp_height = _cogl_bitmap_get_height (source_bmp);
@@ -244,7 +245,8 @@ _cogl_texture_driver_upload_to_gl_3d (GLenum gl_target,
GLuint source_gl_format,
GLuint source_gl_type)
{
- int bpp = _cogl_get_format_bpp (_cogl_bitmap_get_format (source_bmp));
+ CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
+ int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
int rowstride = _cogl_bitmap_get_rowstride (source_bmp);
int bmp_width = _cogl_bitmap_get_width (source_bmp);
int bmp_height = _cogl_bitmap_get_height (source_bmp);