mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
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:
parent
6ddb839711
commit
3729e47ef6
@ -1494,20 +1494,18 @@ _cogl_pipeline_backend_layer_change_notify (CoglPipeline *owner,
|
||||
CoglPipelineLayer *layer,
|
||||
CoglPipelineLayerState change)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* NB: layers may be used by multiple pipelines which may be using
|
||||
* different backends, therefore we determine which backends to
|
||||
* notify based on the private state pointers for each backend...
|
||||
/* NB: Although layers can have private state associated with them
|
||||
* by multiple backends we know that a layer can't be *changed* if
|
||||
* it has multiple dependants so if we reach here we know we only
|
||||
* have a single owner and can only be associated with a single
|
||||
* 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] &&
|
||||
_cogl_pipeline_backends[i]->layer_pre_change_notify)
|
||||
{
|
||||
const CoglPipelineBackend *backend = _cogl_pipeline_backends[i];
|
||||
backend->layer_pre_change_notify (owner, layer, change);
|
||||
}
|
||||
const CoglPipelineBackend *backend =
|
||||
_cogl_pipeline_backends[owner->backend];
|
||||
backend->layer_pre_change_notify (owner, layer, change);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user