summaryrefslogtreecommitdiff
path: root/cogl/cogl-bitmap-private.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2010-12-17 14:52:25 +0000
committerNeil Roberts <neil@linux.intel.com>2011-01-10 16:54:58 +0000
commit0b2dc74dbce582c5ac7d8cababfbadbbf4234dbe (patch)
tree1cf08c5acc512f6b67dc3b94f03d0b7308883e8d /cogl/cogl-bitmap-private.h
parent7ae61c3763ab0c26e9c191f447a37d800207dafd (diff)
downloadcogl-0b2dc74dbce582c5ac7d8cababfbadbbf4234dbe.tar.gz
cogl-texture: Don't use the source rowstride if we have to copy bitmap
If we have to copy the bitmap to do the premultiplication then we were previously using the rowstride of the source image as the rowstride for the new image. This is wasteful if the source image is a subregion of a larger image which would make it use a large rowstride. If we have to copy the data anyway we might as well compact it to the smallest rowstride. This also prevents the copy from reading past the end of the last row of pixels. An internal function called _cogl_bitmap_copy has been added to do the copy. It creates a new bitmap with the smallest possible rowstride rounded up the nearest multiple of 4 bytes. There may be other places in Cogl that are currently assuming we can read height*rowstride of the source buffer so they may want to take advantage of this function too. http://bugzilla.clutter-project.org/show_bug.cgi?id=2491
Diffstat (limited to 'cogl/cogl-bitmap-private.h')
-rw-r--r--cogl/cogl-bitmap-private.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/cogl/cogl-bitmap-private.h b/cogl/cogl-bitmap-private.h
index d14293fa..bf21a573 100644
--- a/cogl/cogl-bitmap-private.h
+++ b/cogl/cogl-bitmap-private.h
@@ -155,6 +155,10 @@ _cogl_bitmap_copy_subregion (CoglBitmap *src,
int width,
int height);
+/* Creates a deep copy of the source bitmap */
+CoglBitmap *
+_cogl_bitmap_copy (CoglBitmap *src_bmp);
+
gboolean
_cogl_bitmap_get_size_from_file (const char *filename,
int *width,