From 1397a2da1992c50ed82f4e31a54c6401a0a3371c Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Sat, 25 Feb 2012 20:18:05 +0000 Subject: [PATCH] Make _cogl_bitmap_get_{width,height,format,rowstride} public This are now marked as public experimental Reviewed-by: Robert Bragg --- cogl/cogl-atlas-texture.c | 14 +++--- cogl/cogl-bitmap-conversion.c | 36 ++++++++-------- cogl/cogl-bitmap-private.h | 12 ------ cogl/cogl-bitmap.c | 34 +++++++-------- cogl/cogl-bitmap.h | 48 ++++++++++++++++++++- cogl/cogl-framebuffer.c | 14 +++--- cogl/cogl-journal.c | 2 +- cogl/cogl-texture-2d-sliced.c | 12 +++--- cogl/cogl-texture-2d.c | 16 +++---- cogl/cogl-texture-3d.c | 6 +-- cogl/cogl-texture-rectangle.c | 10 ++--- cogl/cogl-texture.c | 20 ++++----- cogl/driver/gl/cogl-texture-driver-gl.c | 20 ++++----- cogl/driver/gles/cogl-texture-driver-gles.c | 32 +++++++------- 14 files changed, 155 insertions(+), 121 deletions(-) diff --git a/cogl/cogl-atlas-texture.c b/cogl/cogl-atlas-texture.c index 3aaa97177..2701b8774 100644 --- a/cogl/cogl-atlas-texture.c +++ b/cogl/cogl-atlas-texture.c @@ -528,11 +528,11 @@ _cogl_atlas_texture_prepare_for_upload (CoglAtlasTexture *atlas_tex, override_bmp = _cogl_bitmap_new_shared (converted_bmp, - _cogl_bitmap_get_format (converted_bmp) & + cogl_bitmap_get_format (converted_bmp) & ~COGL_PREMULT_BIT, - _cogl_bitmap_get_width (converted_bmp), - _cogl_bitmap_get_height (converted_bmp), - _cogl_bitmap_get_rowstride (converted_bmp)); + cogl_bitmap_get_width (converted_bmp), + cogl_bitmap_get_height (converted_bmp), + cogl_bitmap_get_rowstride (converted_bmp)); cogl_object_unref (converted_bmp); @@ -739,9 +739,9 @@ _cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp, _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), COGL_INVALID_HANDLE); - bmp_width = _cogl_bitmap_get_width (bmp); - bmp_height = _cogl_bitmap_get_height (bmp); - bmp_format = _cogl_bitmap_get_format (bmp); + bmp_width = cogl_bitmap_get_width (bmp); + bmp_height = cogl_bitmap_get_height (bmp); + bmp_format = cogl_bitmap_get_format (bmp); internal_format = _cogl_texture_determine_internal_format (bmp_format, internal_format); diff --git a/cogl/cogl-bitmap-conversion.c b/cogl/cogl-bitmap-conversion.c index 6ff5a03cd..64ce8cc4c 100644 --- a/cogl/cogl-bitmap-conversion.c +++ b/cogl/cogl-bitmap-conversion.c @@ -360,15 +360,15 @@ _cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp, gboolean use_16; gboolean need_premult; - src_format = _cogl_bitmap_get_format (src_bmp); - src_rowstride = _cogl_bitmap_get_rowstride (src_bmp); - dst_format = _cogl_bitmap_get_format (dst_bmp); - dst_rowstride = _cogl_bitmap_get_rowstride (dst_bmp); - width = _cogl_bitmap_get_width (src_bmp); - height = _cogl_bitmap_get_height (src_bmp); + src_format = cogl_bitmap_get_format (src_bmp); + src_rowstride = cogl_bitmap_get_rowstride (src_bmp); + dst_format = cogl_bitmap_get_format (dst_bmp); + dst_rowstride = cogl_bitmap_get_rowstride (dst_bmp); + width = cogl_bitmap_get_width (src_bmp); + height = cogl_bitmap_get_height (src_bmp); - _COGL_RETURN_VAL_IF_FAIL (width == _cogl_bitmap_get_width (dst_bmp), FALSE); - _COGL_RETURN_VAL_IF_FAIL (height == _cogl_bitmap_get_height (dst_bmp), FALSE); + _COGL_RETURN_VAL_IF_FAIL (width == cogl_bitmap_get_width (dst_bmp), FALSE); + _COGL_RETURN_VAL_IF_FAIL (height == cogl_bitmap_get_height (dst_bmp), FALSE); need_premult = ((src_format & COGL_PREMULT_BIT) != (dst_format & COGL_PREMULT_BIT) && @@ -476,8 +476,8 @@ _cogl_bitmap_convert (CoglBitmap *src_bmp, CoglBitmap *dst_bmp; int width, height; - width = _cogl_bitmap_get_width (src_bmp); - height = _cogl_bitmap_get_height (src_bmp); + width = cogl_bitmap_get_width (src_bmp); + height = cogl_bitmap_get_height (src_bmp); dst_bpp = _cogl_pixel_format_get_bytes_per_pixel (dst_format); dst_rowstride = (sizeof (guint8) * dst_bpp * width + 3) & ~3; @@ -510,10 +510,10 @@ _cogl_bitmap_unpremult (CoglBitmap *bmp) int width, height; int rowstride; - format = _cogl_bitmap_get_format (bmp); - width = _cogl_bitmap_get_width (bmp); - height = _cogl_bitmap_get_height (bmp); - rowstride = _cogl_bitmap_get_rowstride (bmp); + format = cogl_bitmap_get_format (bmp); + width = cogl_bitmap_get_width (bmp); + height = cogl_bitmap_get_height (bmp); + rowstride = cogl_bitmap_get_rowstride (bmp); if ((data = _cogl_bitmap_map (bmp, COGL_BUFFER_ACCESS_READ | @@ -576,10 +576,10 @@ _cogl_bitmap_premult (CoglBitmap *bmp) int width, height; int rowstride; - format = _cogl_bitmap_get_format (bmp); - width = _cogl_bitmap_get_width (bmp); - height = _cogl_bitmap_get_height (bmp); - rowstride = _cogl_bitmap_get_rowstride (bmp); + format = cogl_bitmap_get_format (bmp); + width = cogl_bitmap_get_width (bmp); + height = cogl_bitmap_get_height (bmp); + rowstride = cogl_bitmap_get_rowstride (bmp); if ((data = _cogl_bitmap_map (bmp, COGL_BUFFER_ACCESS_READ | diff --git a/cogl/cogl-bitmap-private.h b/cogl/cogl-bitmap-private.h index f55203533..ab80868fb 100644 --- a/cogl/cogl-bitmap-private.h +++ b/cogl/cogl-bitmap-private.h @@ -124,22 +124,10 @@ _cogl_bitmap_get_size_from_file (const char *filename, int *width, int *height); -CoglPixelFormat -_cogl_bitmap_get_format (CoglBitmap *bitmap); - void _cogl_bitmap_set_format (CoglBitmap *bitmap, CoglPixelFormat format); -int -_cogl_bitmap_get_width (CoglBitmap *bitmap); - -int -_cogl_bitmap_get_height (CoglBitmap *bitmap); - -int -_cogl_bitmap_get_rowstride (CoglBitmap *bitmap); - /* Maps the bitmap so that the pixels can be accessed directly or if the bitmap is just a memory bitmap then it just returns the pointer to memory. Note that the bitmap isn't guaranteed to allocated to diff --git a/cogl/cogl-bitmap.c b/cogl/cogl-bitmap.c index d9c083317..f297d93de 100644 --- a/cogl/cogl-bitmap.c +++ b/cogl/cogl-bitmap.c @@ -104,10 +104,10 @@ CoglBitmap * _cogl_bitmap_copy (CoglBitmap *src_bmp) { CoglBitmap *dst_bmp; - CoglPixelFormat src_format = _cogl_bitmap_get_format (src_bmp); + CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp); 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 width = cogl_bitmap_get_width (src_bmp); + int height = cogl_bitmap_get_height (src_bmp); int dst_rowstride = width * bpp; /* Round the rowstride up to the next nearest multiple of 4 bytes */ @@ -300,7 +300,7 @@ cogl_bitmap_new_with_size (CoglContext *context, } CoglPixelFormat -_cogl_bitmap_get_format (CoglBitmap *bitmap) +cogl_bitmap_get_format (CoglBitmap *bitmap) { return bitmap->format; } @@ -313,29 +313,29 @@ _cogl_bitmap_set_format (CoglBitmap *bitmap, } int -_cogl_bitmap_get_width (CoglBitmap *bitmap) +cogl_bitmap_get_width (CoglBitmap *bitmap) { return bitmap->width; } +int +cogl_bitmap_get_height (CoglBitmap *bitmap) +{ + return bitmap->height; +} + +int +cogl_bitmap_get_rowstride (CoglBitmap *bitmap) +{ + return bitmap->rowstride; +} + GQuark cogl_bitmap_error_quark (void) { return g_quark_from_static_string ("cogl-bitmap-error-quark"); } -int -_cogl_bitmap_get_height (CoglBitmap *bitmap) -{ - return bitmap->height; -} - -int -_cogl_bitmap_get_rowstride (CoglBitmap *bitmap) -{ - return bitmap->rowstride; -} - guint8 * _cogl_bitmap_map (CoglBitmap *bitmap, CoglBufferAccess access, diff --git a/cogl/cogl-bitmap.h b/cogl/cogl-bitmap.h index 87534d987..934715ce8 100644 --- a/cogl/cogl-bitmap.h +++ b/cogl/cogl-bitmap.h @@ -128,7 +128,53 @@ cogl_bitmap_new_with_size (CoglContext *context, unsigned int height, CoglPixelFormat format); -#endif +/** + * cogl_bitmap_get_format: + * @bitmap: A #CoglBitmap + * + * Return value: the #CoglPixelFormat that the data for the bitmap is in. + * Since: 1.10 + * Stability: unstable + */ +CoglPixelFormat +cogl_bitmap_get_format (CoglBitmap *bitmap); + +/** + * cogl_bitmap_get_width: + * @bitmap: A #CoglBitmap + * + * Return value: the width of the bitmap + * Since: 1.10 + * Stability: unstable + */ +int +cogl_bitmap_get_width (CoglBitmap *bitmap); + +/** + * cogl_bitmap_get_height: + * @bitmap: A #CoglBitmap + * + * Return value: the height of the bitmap + * Since: 1.10 + * Stability: unstable + */ +int +cogl_bitmap_get_height (CoglBitmap *bitmap); + +/** + * cogl_bitmap_get_rowstride: + * @bitmap: A #CoglBitmap + * + * Return value: the rowstride of the bitmap. This is the number of + * bytes between the address of start of one row to the address of the + * next row in the image. + * Since: 1.10 + * Stability: unstable + */ +int +cogl_bitmap_get_rowstride (CoglBitmap *bitmap); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ /** * cogl_bitmap_get_size_from_file: diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c index e3f123978..999eccc3b 100644 --- a/cogl/cogl-framebuffer.c +++ b/cogl/cogl-framebuffer.c @@ -1879,7 +1879,7 @@ _cogl_framebuffer_try_fast_read_pixel (CoglFramebuffer *framebuffer, if (source != COGL_READ_PIXELS_COLOR_BUFFER) return FALSE; - format = _cogl_bitmap_get_format (bitmap); + format = cogl_bitmap_get_format (bitmap); if (format != COGL_PIXEL_FORMAT_RGBA_8888_PRE && format != COGL_PIXEL_FORMAT_RGBA_8888) @@ -1960,8 +1960,8 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, ctx = cogl_framebuffer_get_context (framebuffer); - width = _cogl_bitmap_get_width (bitmap); - height = _cogl_bitmap_get_height (bitmap); + width = cogl_bitmap_get_width (bitmap); + height = cogl_bitmap_get_height (bitmap); if (width == 1 && height == 1 && !framebuffer->clear_clip_dirty) { @@ -1998,7 +1998,7 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, if (!cogl_is_offscreen (framebuffer)) y = framebuffer_height - y - height; - format = _cogl_bitmap_get_format (bitmap); + format = cogl_bitmap_get_format (bitmap); required_format = ctx->texture_driver->pixel_format_to_gl (format, &gl_intformat, @@ -2028,7 +2028,7 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, because GLES does not support setting GL_ROW_LENGTH */ if ((ctx->driver != COGL_DRIVER_GL && (gl_format != GL_RGBA || gl_type != GL_UNSIGNED_BYTE || - _cogl_bitmap_get_rowstride (bitmap) != 4 * width)) || + cogl_bitmap_get_rowstride (bitmap) != 4 * width)) || (required_format & ~COGL_PREMULT_BIT) != (format & ~COGL_PREMULT_BIT)) { CoglBitmap *tmp_bmp; @@ -2081,7 +2081,7 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, gboolean succeeded = FALSE; guint8 *pixels; - rowstride = _cogl_bitmap_get_rowstride (bitmap); + rowstride = cogl_bitmap_get_rowstride (bitmap); /* We match the premultiplied state of the target buffer to the * premultiplied state of the framebuffer so that it will get @@ -2141,7 +2141,7 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, int rowstride; guint8 *pixels; - rowstride = _cogl_bitmap_get_rowstride (bitmap); + rowstride = cogl_bitmap_get_rowstride (bitmap); pixels = _cogl_bitmap_map (bitmap, COGL_BUFFER_ACCESS_READ | COGL_BUFFER_ACCESS_WRITE, diff --git a/cogl/cogl-journal.c b/cogl/cogl-journal.c index a5811294e..0be94f599 100644 --- a/cogl/cogl-journal.c +++ b/cogl/cogl-journal.c @@ -1810,7 +1810,7 @@ _cogl_journal_try_read_pixel (CoglJournal *journal, if (journal->fast_read_pixel_count > 50) return FALSE; - format = _cogl_bitmap_get_format (bitmap); + format = cogl_bitmap_get_format (bitmap); if (format != COGL_PIXEL_FORMAT_RGBA_8888_PRE && format != COGL_PIXEL_FORMAT_RGBA_8888) diff --git a/cogl/cogl-texture-2d-sliced.c b/cogl/cogl-texture-2d-sliced.c index 7a01df749..73ed34889 100644 --- a/cogl/cogl-texture-2d-sliced.c +++ b/cogl/cogl-texture-2d-sliced.c @@ -187,8 +187,8 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds, if (need_x || need_y) { - int bmp_rowstride = _cogl_bitmap_get_rowstride (source_bmp); - CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp); + int bmp_rowstride = cogl_bitmap_get_rowstride (source_bmp); + CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); guint8 *bmp_data; const guint8 *src; @@ -318,7 +318,7 @@ _cogl_texture_2d_sliced_upload_to_gl (CoglTexture2DSliced *tex_2ds, guint8 *waste_buf; CoglPixelFormat bmp_format; - bmp_format = _cogl_bitmap_get_format (bmp); + bmp_format = cogl_bitmap_get_format (bmp); waste_buf = _cogl_texture_2d_sliced_allocate_waste_buffer (tex_2ds, bmp_format); @@ -406,7 +406,7 @@ _cogl_texture_2d_sliced_upload_subregion_to_gl (CoglTexture2DSliced *tex_2ds, guint8 *waste_buf; CoglPixelFormat source_format; - source_format = _cogl_bitmap_get_format (source_bmp); + source_format = cogl_bitmap_get_format (source_bmp); waste_buf = _cogl_texture_2d_sliced_allocate_waste_buffer (tex_2ds, source_format); @@ -884,8 +884,8 @@ _cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp, _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL); - width = _cogl_bitmap_get_width (bmp); - height = _cogl_bitmap_get_height (bmp); + width = cogl_bitmap_get_width (bmp); + height = cogl_bitmap_get_height (bmp); /* Create new texture and fill with loaded data */ tex_2ds = g_new0 (CoglTexture2DSliced, 1); diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c index cabae1f86..da57cb4f7 100644 --- a/cogl/cogl-texture-2d.c +++ b/cogl/cogl-texture-2d.c @@ -228,11 +228,11 @@ _cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp, _COGL_RETURN_VAL_IF_FAIL (bmp != NULL, COGL_INVALID_HANDLE); internal_format = - _cogl_texture_determine_internal_format (_cogl_bitmap_get_format (bmp), + _cogl_texture_determine_internal_format (cogl_bitmap_get_format (bmp), internal_format); - if (!_cogl_texture_2d_can_create (_cogl_bitmap_get_width (bmp), - _cogl_bitmap_get_height (bmp), + if (!_cogl_texture_2d_can_create (cogl_bitmap_get_width (bmp), + cogl_bitmap_get_height (bmp), internal_format)) { g_set_error (error, COGL_TEXTURE_ERROR, @@ -256,8 +256,8 @@ _cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp, return NULL; } - tex_2d = _cogl_texture_2d_create_base (_cogl_bitmap_get_width (bmp), - _cogl_bitmap_get_height (bmp), + tex_2d = _cogl_texture_2d_create_base (cogl_bitmap_get_width (bmp), + cogl_bitmap_get_height (bmp), flags, internal_format); @@ -267,7 +267,7 @@ _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); + 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, @@ -770,11 +770,11 @@ _cogl_texture_2d_set_region (CoglTexture *tex, (data = _cogl_bitmap_map (bmp, COGL_BUFFER_ACCESS_READ, 0))) { CoglPixelFormat bpp = - _cogl_pixel_format_get_bytes_per_pixel (_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, - data + _cogl_bitmap_get_rowstride (bmp) * src_y + bpp * src_x, + data + cogl_bitmap_get_rowstride (bmp) * src_y + bpp * src_x, bpp); _cogl_bitmap_unmap (bmp); diff --git a/cogl/cogl-texture-3d.c b/cogl/cogl-texture-3d.c index ee80d62d6..956d9b13c 100644 --- a/cogl/cogl-texture-3d.c +++ b/cogl/cogl-texture-3d.c @@ -249,8 +249,8 @@ _cogl_texture_3d_new_from_bitmap (CoglContext *ctx, GLenum gl_type; guint8 *data; - bmp_width = _cogl_bitmap_get_width (bmp); - bmp_format = _cogl_bitmap_get_format (bmp); + bmp_width = cogl_bitmap_get_width (bmp); + bmp_format = cogl_bitmap_get_format (bmp); internal_format = _cogl_texture_determine_internal_format (bmp_format, internal_format); @@ -285,7 +285,7 @@ _cogl_texture_3d_new_from_bitmap (CoglContext *ctx, (data = _cogl_bitmap_map (dst_bmp, COGL_BUFFER_ACCESS_READ, 0))) { - CoglPixelFormat format = _cogl_bitmap_get_format (dst_bmp); + 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, diff --git a/cogl/cogl-texture-rectangle.c b/cogl/cogl-texture-rectangle.c index 7580fc9fb..b906f5878 100644 --- a/cogl/cogl-texture-rectangle.c +++ b/cogl/cogl-texture-rectangle.c @@ -230,11 +230,11 @@ _cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp, _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL); internal_format = - _cogl_texture_determine_internal_format (_cogl_bitmap_get_format (bmp), + _cogl_texture_determine_internal_format (cogl_bitmap_get_format (bmp), internal_format); - if (!_cogl_texture_rectangle_can_create (_cogl_bitmap_get_width (bmp), - _cogl_bitmap_get_height (bmp), + if (!_cogl_texture_rectangle_can_create (cogl_bitmap_get_width (bmp), + cogl_bitmap_get_height (bmp), internal_format, NULL)) return NULL; @@ -249,8 +249,8 @@ _cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp, if (dst_bmp == NULL) return NULL; - tex_rect = _cogl_texture_rectangle_create_base (_cogl_bitmap_get_width (bmp), - _cogl_bitmap_get_height (bmp), + tex_rect = _cogl_texture_rectangle_create_base (cogl_bitmap_get_width (bmp), + cogl_bitmap_get_height (bmp), internal_format); ctx->texture_driver->gen (GL_TEXTURE_RECTANGLE_ARB, 1, &tex_rect->gl_texture); diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c index e3618d54d..dd27b34e8 100644 --- a/cogl/cogl-texture.c +++ b/cogl/cogl-texture.c @@ -177,7 +177,7 @@ _cogl_texture_prepare_for_upload (CoglBitmap *src_bmp, GLenum *out_glformat, GLenum *out_gltype) { - CoglPixelFormat src_format = _cogl_bitmap_get_format (src_bmp); + CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp); CoglBitmap *dst_bmp; _COGL_GET_CONTEXT (ctx, NULL); @@ -397,7 +397,7 @@ cogl_texture_new_from_file (const char *filename, if (bmp == NULL) return NULL; - src_format = _cogl_bitmap_get_format (bmp); + src_format = cogl_bitmap_get_format (bmp); /* We know that the bitmap data is solely owned by this function so we can do the premult conversion in place. This avoids having to @@ -621,9 +621,9 @@ cogl_texture_set_region_from_bitmap (CoglTexture *texture, { gboolean ret; - _COGL_RETURN_VAL_IF_FAIL ((_cogl_bitmap_get_width (bmp) - src_x) + _COGL_RETURN_VAL_IF_FAIL ((cogl_bitmap_get_width (bmp) - src_x) >= dst_width, FALSE); - _COGL_RETURN_VAL_IF_FAIL ((_cogl_bitmap_get_height (bmp) - src_y) + _COGL_RETURN_VAL_IF_FAIL ((cogl_bitmap_get_height (bmp) - src_y) >= dst_height, FALSE); /* Shortcut out early if the image is empty */ @@ -819,9 +819,9 @@ _cogl_texture_draw_and_read (CoglTexture *texture, CoglFramebuffer *framebuffer; float viewport[4]; CoglBitmap *alpha_bmp; - int target_width = _cogl_bitmap_get_width (target_bmp); - int target_height = _cogl_bitmap_get_height (target_bmp); - int target_rowstride = _cogl_bitmap_get_rowstride (target_bmp); + int target_width = cogl_bitmap_get_width (target_bmp); + int target_height = cogl_bitmap_get_height (target_bmp); + int target_rowstride = cogl_bitmap_get_rowstride (target_bmp); _COGL_GET_CONTEXT (ctx, FALSE); @@ -1057,9 +1057,9 @@ texture_get_cb (CoglTexture *texture, void *user_data) { CoglTextureGetData *tg_data = user_data; - CoglPixelFormat format = _cogl_bitmap_get_format (tg_data->target_bmp); + CoglPixelFormat format = cogl_bitmap_get_format (tg_data->target_bmp); int bpp = _cogl_pixel_format_get_bytes_per_pixel (format); - unsigned int rowstride = _cogl_bitmap_get_rowstride (tg_data->target_bmp); + 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); @@ -1248,7 +1248,7 @@ cogl_texture_get_data (CoglTexture *texture, if (new_bmp == NULL) return 0; - new_bmp_rowstride = _cogl_bitmap_get_rowstride (new_bmp); + new_bmp_rowstride = cogl_bitmap_get_rowstride (new_bmp); new_bmp_data = _cogl_bitmap_map (new_bmp, COGL_BUFFER_ACCESS_WRITE, COGL_BUFFER_MAP_HINT_DISCARD); diff --git a/cogl/driver/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/cogl-texture-driver-gl.c index 3c2296e69..83d47ae5d 100644 --- a/cogl/driver/gl/cogl-texture-driver-gl.c +++ b/cogl/driver/gl/cogl-texture-driver-gl.c @@ -157,7 +157,7 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target, GLuint source_gl_type) { guint8 *data; - CoglPixelFormat source_format = _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); @@ -165,7 +165,7 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target, data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0); /* Setup gl alignment to match rowstride and top-left corner */ - prep_gl_for_pixels_upload_full (_cogl_bitmap_get_rowstride (source_bmp), + prep_gl_for_pixels_upload_full (cogl_bitmap_get_rowstride (source_bmp), 0, src_x, src_y, @@ -193,7 +193,7 @@ _cogl_texture_driver_upload_to_gl (GLenum gl_target, GLuint source_gl_type) { guint8 *data; - CoglPixelFormat source_format = _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); @@ -201,15 +201,15 @@ _cogl_texture_driver_upload_to_gl (GLenum gl_target, data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0); /* Setup gl alignment to match rowstride and top-left corner */ - prep_gl_for_pixels_upload_full (_cogl_bitmap_get_rowstride (source_bmp), + prep_gl_for_pixels_upload_full (cogl_bitmap_get_rowstride (source_bmp), 0, 0, 0, bpp); _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); GE( ctx, glTexImage2D (gl_target, 0, internal_gl_format, - _cogl_bitmap_get_width (source_bmp), - _cogl_bitmap_get_height (source_bmp), + cogl_bitmap_get_width (source_bmp), + cogl_bitmap_get_height (source_bmp), 0, source_gl_format, source_gl_type, @@ -230,7 +230,7 @@ _cogl_texture_driver_upload_to_gl_3d (GLenum gl_target, GLuint source_gl_type) { guint8 *data; - CoglPixelFormat source_format = _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); @@ -238,8 +238,8 @@ _cogl_texture_driver_upload_to_gl_3d (GLenum gl_target, data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0); /* Setup gl alignment to match rowstride and top-left corner */ - prep_gl_for_pixels_upload_full (_cogl_bitmap_get_rowstride (source_bmp), - (_cogl_bitmap_get_height (source_bmp) / + prep_gl_for_pixels_upload_full (cogl_bitmap_get_rowstride (source_bmp), + (cogl_bitmap_get_height (source_bmp) / depth), 0, 0, bpp); @@ -248,7 +248,7 @@ _cogl_texture_driver_upload_to_gl_3d (GLenum gl_target, GE( ctx, glTexImage3D (gl_target, 0, /* level */ internal_gl_format, - _cogl_bitmap_get_width (source_bmp), + cogl_bitmap_get_width (source_bmp), height, depth, 0, diff --git a/cogl/driver/gles/cogl-texture-driver-gles.c b/cogl/driver/gles/cogl-texture-driver-gles.c index 817ee93f9..df7a39829 100644 --- a/cogl/driver/gles/cogl-texture-driver-gles.c +++ b/cogl/driver/gles/cogl-texture-driver-gles.c @@ -100,10 +100,10 @@ _cogl_texture_driver_prep_gl_for_pixels_download (int pixels_rowstride, static CoglBitmap * prepare_bitmap_alignment_for_upload (CoglBitmap *src_bmp) { - CoglPixelFormat format = _cogl_bitmap_get_format (src_bmp); + CoglPixelFormat format = cogl_bitmap_get_format (src_bmp); 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 src_rowstride = cogl_bitmap_get_rowstride (src_bmp); + int width = cogl_bitmap_get_width (src_bmp); int alignment = 1; if (src_rowstride == 0) @@ -138,7 +138,7 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target, GLuint source_gl_type) { guint8 *data; - CoglPixelFormat source_format = _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); CoglBitmap *slice_bmp; int rowstride; @@ -148,8 +148,8 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target, /* If we are copying a sub region of the source bitmap then we need to copy it because GLES does not support GL_UNPACK_ROW_LENGTH */ if (src_x != 0 || src_y != 0 || - width != _cogl_bitmap_get_width (source_bmp) || - height != _cogl_bitmap_get_height (source_bmp)) + width != cogl_bitmap_get_width (source_bmp) || + height != cogl_bitmap_get_height (source_bmp)) { rowstride = bpp * width; rowstride = (rowstride + 3) & ~3; @@ -169,7 +169,7 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target, else { slice_bmp = prepare_bitmap_alignment_for_upload (source_bmp); - rowstride = _cogl_bitmap_get_rowstride (slice_bmp); + rowstride = cogl_bitmap_get_rowstride (slice_bmp); } /* Setup gl alignment to match rowstride and top-left corner */ @@ -200,18 +200,18 @@ _cogl_texture_driver_upload_to_gl (GLenum gl_target, GLuint source_gl_format, GLuint source_gl_type) { - CoglPixelFormat source_format = _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); + int bmp_width = cogl_bitmap_get_width (source_bmp); + int bmp_height = cogl_bitmap_get_height (source_bmp); CoglBitmap *bmp; guint8 *data; _COGL_GET_CONTEXT (ctx, NO_RETVAL); bmp = prepare_bitmap_alignment_for_upload (source_bmp); - rowstride = _cogl_bitmap_get_rowstride (bmp); + rowstride = cogl_bitmap_get_rowstride (bmp); /* Setup gl alignment to match rowstride and top-left corner */ _cogl_texture_driver_prep_gl_for_pixels_upload (rowstride, bpp); @@ -244,11 +244,11 @@ _cogl_texture_driver_upload_to_gl_3d (GLenum gl_target, GLuint source_gl_format, GLuint source_gl_type) { - CoglPixelFormat source_format = _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); + 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); guint8 *data; _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -282,7 +282,7 @@ _cogl_texture_driver_upload_to_gl_3d (GLenum gl_target, NULL) ); bmp = _cogl_bitmap_new_from_data (g_malloc (bpp * bmp_width * height), - _cogl_bitmap_get_format (source_bmp), + cogl_bitmap_get_format (source_bmp), bmp_width, height, bpp * bmp_width,