cogl-material: Fix the function which sets the enable blend flag

This function had two problems. Firstly it would clear the enable
blend flag before calling pre_change_notify so that if blending was
previously enabled the journal would end up being flushed while the
flag was still cleared. Secondly it would call the pre change notify
whenever blending is needed regardless of whether it was already
needed previously.

This was causing problems in test-depth.
This commit is contained in:
Neil Roberts 2010-06-09 13:53:34 +01:00 committed by Robert Bragg
parent 82e80e6765
commit cce5616edf

View File

@ -359,14 +359,19 @@ _cogl_material_pre_change_notify (CoglMaterial *material,
static void
handle_automatic_blend_enable (CoglMaterial *material)
{
material->flags &= ~COGL_MATERIAL_FLAG_ENABLE_BLEND;
gboolean needs_blending_enabled =
_cogl_material_needs_blending_enabled (material, NULL);
if (_cogl_material_needs_blending_enabled (material, NULL))
if (needs_blending_enabled !=
!!(material->flags & COGL_MATERIAL_FLAG_ENABLE_BLEND))
{
_cogl_material_pre_change_notify (material,
COGL_MATERIAL_CHANGE_ENABLE_BLEND,
NULL);
if (needs_blending_enabled)
material->flags |= COGL_MATERIAL_FLAG_ENABLE_BLEND;
else
material->flags &= ~COGL_MATERIAL_FLAG_ENABLE_BLEND;
}
}