From 6b1b27d4f894cbefc90601eaf6214b55a71834b7 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Sat, 6 Feb 2010 00:12:10 +0000 Subject: [PATCH] cogl-bitmap: Update the format after (un)premultiplying The pixel format of the bitmap needs to have its premult flag cleared or set after the premult conversion otherwise it may get converted again. --- clutter/cogl/cogl/cogl-bitmap-fallback.c | 4 ++++ clutter/cogl/cogl/cogl-texture.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/clutter/cogl/cogl/cogl-bitmap-fallback.c b/clutter/cogl/cogl/cogl-bitmap-fallback.c index 097cc52..a02d856 100644 --- a/clutter/cogl/cogl/cogl-bitmap-fallback.c +++ b/clutter/cogl/cogl/cogl-bitmap-fallback.c @@ -379,6 +379,8 @@ _cogl_bitmap_fallback_unpremult (CoglBitmap *bmp) } } + bmp->format &= ~COGL_PREMULT_BIT; + return TRUE; } @@ -414,6 +416,8 @@ _cogl_bitmap_fallback_premult (CoglBitmap *bmp) } } + bmp->format |= COGL_PREMULT_BIT; + return TRUE; } diff --git a/clutter/cogl/cogl/cogl-texture.c b/clutter/cogl/cogl/cogl-texture.c index db9a065..ec69aca 100644 --- a/clutter/cogl/cogl/cogl-texture.c +++ b/clutter/cogl/cogl/cogl-texture.c @@ -415,8 +415,7 @@ cogl_texture_new_from_file (const gchar *filename, internal_format = _cogl_texture_determine_internal_format (bmp->format, internal_format); if (!_cogl_texture_needs_premult_conversion (bmp->format, internal_format) || - _cogl_bitmap_convert_premult_status (bmp, - bmp->format ^= COGL_PREMULT_BIT)) + _cogl_bitmap_convert_premult_status (bmp, bmp->format ^ COGL_PREMULT_BIT)) handle = cogl_texture_new_from_bitmap (bmp, flags, internal_format); cogl_handle_unref (bmp); -- 2.7.4