From b9a9bf60b7b6b0d80f0b97a43527d7d6fd83b9f8 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. --- cogl/cogl-bitmap-fallback.c | 4 ++++ cogl/cogl-texture.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cogl/cogl-bitmap-fallback.c b/cogl/cogl-bitmap-fallback.c index 097cc5292..a02d85611 100644 --- a/cogl/cogl-bitmap-fallback.c +++ b/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/cogl/cogl-texture.c b/cogl/cogl-texture.c index db9a0650d..ec69aca6f 100644 --- a/cogl/cogl-texture.c +++ b/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);