diff options
author | Robert Bragg <robert@linux.intel.com> | 2013-06-09 01:06:20 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2013-07-11 21:05:58 +0100 |
commit | 1c809210092a8c5e223edfcab1e378b205cf35d6 (patch) | |
tree | 2870f1ed558d8ea901784be582843e8de01bde7c | |
parent | d3af8dc9bf6c4c1b09a4f7559b0375f848368c10 (diff) | |
download | cogl-1c809210092a8c5e223edfcab1e378b205cf35d6.tar.gz |
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>
-rw-r--r-- | 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 e8779a99..274d4ad4 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; |