[cogl] bitmap: Use the 'copy' blend mode when loading images on Quartz
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] bitmap: Use the 'copy' blend mode when loading images on Quartz
- Date: Wed, 15 Aug 2012 13:10:13 +0000 (UTC)
commit 5ba7f4e6837a539d92cbe45491f79a8926fd6828
Author: Neil Roberts <neil linux intel com>
Date: Wed Jul 18 11:28:13 2012 +0100
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>
cogl/cogl-bitmap-pixbuf.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-bitmap-pixbuf.c b/cogl/cogl-bitmap-pixbuf.c
index d30a851..ba31c56 100644
--- a/cogl/cogl-bitmap-pixbuf.c
+++ b/cogl/cogl-bitmap-pixbuf.c
@@ -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}};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]