From 6ad668c76b126efec977b09c8796f245f73b85cb Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Tue, 1 Jun 2010 13:32:57 +0100 Subject: [PATCH] cogl-texture: Avoid premult conversion if the dst format has no alpha The _cogl_texture_needs_premult_conversion function was already checking whether the source format had an alpha channel before returning TRUE, but it also doesn't make sense to do the premult conversion if the destination format has no alpha. This patch adds that check in too. --- cogl/cogl-texture.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c index 9dea40e64..3338df9e6 100644 --- a/cogl/cogl-texture.c +++ b/cogl/cogl-texture.c @@ -125,8 +125,9 @@ static gboolean _cogl_texture_needs_premult_conversion (CoglPixelFormat src_format, CoglPixelFormat dst_format) { - return ((src_format & COGL_A_BIT) && + return ((src_format & dst_format & COGL_A_BIT) && src_format != COGL_PIXEL_FORMAT_A_8 && + dst_format != COGL_PIXEL_FORMAT_A_8 && (src_format & COGL_PREMULT_BIT) != (dst_format & COGL_PREMULT_BIT)); }