[cogl/cogl-1.16] bitmap: calc rowstride from width * bpp if 0
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/cogl-1.16] bitmap: calc rowstride from width * bpp if 0
- Date: Tue, 30 Jul 2013 14:17:27 +0000 (UTC)
commit 7d2e23bd7544cdc53da55d8789954ba6010f5a56
Author: Robert Bragg <robert linux intel com>
Date: Sun Jun 9 01:06:20 2013 +0100
bitmap: calc rowstride from width * bpp if 0
This updates cogl_bitmap_new_for_data() to calculate the rowstride from
the width and bpp if the given rowstride is 0, to be consistent with how
the texture apis work.
Reviewed-by: Neil Roberts <neil linux intel com>
(cherry picked from commit 1c809210092a8c5e223edfcab1e378b205cf35d6)
cogl/cogl-bitmap.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-bitmap.c b/cogl/cogl-bitmap.c
index 58890fc..9b51a30 100644
--- a/cogl/cogl-bitmap.c
+++ b/cogl/cogl-bitmap.c
@@ -178,6 +178,10 @@ cogl_bitmap_new_for_data (CoglContext *context,
g_return_val_if_fail (cogl_is_context (context), NULL);
+ /* Rowstride from width if not given */
+ if (rowstride == 0)
+ rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
+
bmp = g_slice_new (CoglBitmap);
bmp->context = context;
bmp->format = format;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]