Read-only mirror of https://gitlab.gnome.org/GNOME/mutter
c5205c50d2
The docs for GdkPixbuf say that the last row of the image won't necessarily be allocated to the size of the full rowstride. The rest of Cogl and possibly GL assumes that we can copy the bitmap with memcpy(height*rowstride) so we previously would copy the pixbuf data to ensure this. However if the rowstride is the same as bpp*width then there is no way for the last row to be under-allocated so in this case we can just directly upload from the gdk pixbuf. Now that CoglBitmap can be created with a destroy function we can make it keep a reference to the pixbuf and unref it during its destroy callback. GdkPixbuf seems to always pack the image with no padding between rows even if it is RGB so this should end up always avoiding the memcpy. The fallback code for when we do have to copy the pixbuf is now simplified so that it copies all of the rows in a single loop. We only copy the useful region of each row so this should be safe. The rowstride of the CoglBitmap is now always allocated to bpp*width regardless of the rowstride of the pixbuf. |
||
---|---|---|
cogl | ||
doc | ||
pango | ||
Makefile.am |