culling: check volume->is_empty before ->is_complete

As documented in cogl-pipeline-private.h, there is a precedence to the
ClutterPaintVolume bitfields that should be considered whenever we
implement code that manipulates PaintVolumes...

Firstly if ->is_empty == TRUE then the values for ->is_complete and
->is_2d are undefined, so we should typically check ->is_empty as the
first priority.

This fixes a bug in _clutter_paint_volume_cull() whereby we were
checking pv->is_complete before checking pv->is_empty which was
resulting in assertions for actors with no size.
This commit is contained in:
Robert Bragg 2011-03-10 13:42:11 +00:00
parent 0b9aa1fa24
commit 3303b08174

View File

@ -923,14 +923,14 @@ _clutter_paint_volume_cull (ClutterPaintVolume *pv,
int i;
int j;
if (pv->is_empty)
return CLUTTER_CULL_RESULT_OUT;
/* We expect the volume to already be transformed into eye coordinates
*/
g_return_val_if_fail (pv->is_complete == TRUE, CLUTTER_CULL_RESULT_IN);
g_return_val_if_fail (pv->actor == NULL, CLUTTER_CULL_RESULT_IN);
if (pv->is_empty)
return CLUTTER_CULL_RESULT_OUT;
/* Most actors are 2D so we only have to transform the front 4
* vertices of the paint volume... */
if (G_LIKELY (pv->is_2d))