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.
This commit is contained in:
Neil Roberts 2010-02-06 00:12:10 +00:00
parent 45215cb426
commit b9a9bf60b7
2 changed files with 5 additions and 2 deletions

View File

@ -379,6 +379,8 @@ _cogl_bitmap_fallback_unpremult (CoglBitmap *bmp)
} }
} }
bmp->format &= ~COGL_PREMULT_BIT;
return TRUE; return TRUE;
} }
@ -414,6 +416,8 @@ _cogl_bitmap_fallback_premult (CoglBitmap *bmp)
} }
} }
bmp->format |= COGL_PREMULT_BIT;
return TRUE; return TRUE;
} }

View File

@ -415,8 +415,7 @@ cogl_texture_new_from_file (const gchar *filename,
internal_format = _cogl_texture_determine_internal_format (bmp->format, internal_format = _cogl_texture_determine_internal_format (bmp->format,
internal_format); internal_format);
if (!_cogl_texture_needs_premult_conversion (bmp->format, internal_format) || if (!_cogl_texture_needs_premult_conversion (bmp->format, internal_format) ||
_cogl_bitmap_convert_premult_status (bmp, _cogl_bitmap_convert_premult_status (bmp, bmp->format ^ COGL_PREMULT_BIT))
bmp->format ^= COGL_PREMULT_BIT))
handle = cogl_texture_new_from_bitmap (bmp, flags, internal_format); handle = cogl_texture_new_from_bitmap (bmp, flags, internal_format);
cogl_handle_unref (bmp); cogl_handle_unref (bmp);