cogl-texture: Don't use the source rowstride if we have to copy bitmap
authorNeil Roberts <neil@linux.intel.com>
Fri, 17 Dec 2010 14:52:25 +0000 (14:52 +0000)
committerNeil Roberts <neil@linux.intel.com>
Mon, 10 Jan 2011 16:54:58 +0000 (16:54 +0000)
commit91c16023066b3d71ed569e0dcb97bdd0fe8b4667
tree0d408e7488dc3c0fa799b0fc6a9ead97d4ece0a9
parentc6fbc8c567ebe7eb538e53c0a5964db4ff6aebf2
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
clutter/cogl/cogl/cogl-bitmap-private.h
clutter/cogl/cogl/cogl-bitmap.c
clutter/cogl/cogl/cogl-texture.c