bitmap: Use the 'copy' blend mode when loading images on Quartz

When loading images on Quartz, the image is rendered into a bitmap
context using a buffer allocated with
_cogl_bitmap_new_with_malloc_buffer. However this buffer is not
initialised and by default Quartz will blend the source image with the
destination so if there are transparent parts in the source image it
will leave garbage in the destination. This patch changes the blend
mode to 'copy' so that it won't try to blend.

Before 5b785dd4 the buffer was cleared because it was allocated with
g_malloc0 so it was working in that case. Presumably it should be more
efficient to disable blending and avoid the clear though.

https://bugzilla.gnome.org/show_bug.cgi?id=680124

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 5ba7f4e6837a539d92cbe45491f79a8926fd6828)
This commit is contained in:
Neil Roberts 2012-07-18 11:28:13 +01:00 committed by Robert Bragg
parent 470273db7e
commit 41539dd7f0

View File

@ -139,6 +139,8 @@ _cogl_bitmap_from_file (CoglContext *ctx,
kCGImageAlphaPremultipliedFirst);
CGColorSpaceRelease (color_space);
CGContextSetBlendMode (bitmap_context, kCGBlendModeCopy);
{
const CGRect rect = {{0, 0}, {width, height}};