pipeline: Simplify layer change notifications to backend

Previously we used the layers->backend_priv[] members to determine when
to notify backends about layer changes, but it entirely up to the
backends if they want to associate private state with layers, even
though they may still be interested in layer change notifications (they
may associate layer related state with the owner pipeline).

We now make the observation that in
_cogl_pipeline_backend_layer_change_notify we should be able to assume
there can only be one backend currently associated with the layer
because we wouldn't allow changes to a layer with multiple dependants.
This means we can determine the backend to notify by looking at the
owner pipeline instead.
This commit is contained in:
Robert Bragg 2010-11-25 13:19:59 +00:00
parent 7474d320f6
commit cf647e327f

View File

@ -1494,21 +1494,19 @@ _cogl_pipeline_backend_layer_change_notify (CoglPipeline *owner,
CoglPipelineLayer *layer, CoglPipelineLayer *layer,
CoglPipelineLayerState change) CoglPipelineLayerState change)
{ {
int i; /* NB: Although layers can have private state associated with them
* by multiple backends we know that a layer can't be *changed* if
/* NB: layers may be used by multiple pipelines which may be using * it has multiple dependants so if we reach here we know we only
* different backends, therefore we determine which backends to * have a single owner and can only be associated with a single
* notify based on the private state pointers for each backend... * backend that needs to be notified of the layer change...
*/ */
for (i = 0; i < COGL_PIPELINE_N_BACKENDS; i++) if (owner->backend != COGL_PIPELINE_BACKEND_UNDEFINED &&
_cogl_pipeline_backends[owner->backend]->layer_pre_change_notify)
{ {
if (layer->backend_priv[i] && const CoglPipelineBackend *backend =
_cogl_pipeline_backends[i]->layer_pre_change_notify) _cogl_pipeline_backends[owner->backend];
{
const CoglPipelineBackend *backend = _cogl_pipeline_backends[i];
backend->layer_pre_change_notify (owner, layer, change); backend->layer_pre_change_notify (owner, layer, change);
} }
}
} }
unsigned int unsigned int