mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
clutter/actor: Add culling inhibiting API
This will allow us to continue painting actors that are outside the visible boundaries of the stage view. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1129
This commit is contained in:
parent
f6700f19a7
commit
73250b8f4c
@ -710,6 +710,7 @@ struct _ClutterActorPrivate
|
||||
|
||||
guint8 opacity;
|
||||
gint opacity_override;
|
||||
unsigned int inhibit_culling_counter;
|
||||
|
||||
ClutterOffscreenRedirect offscreen_redirect;
|
||||
|
||||
@ -3951,6 +3952,7 @@ clutter_actor_paint (ClutterActor *self,
|
||||
g_autoptr (ClutterPaintNode) root_node = NULL;
|
||||
ClutterActorPrivate *priv;
|
||||
ClutterActorBox clip;
|
||||
gboolean culling_inhibited;
|
||||
gboolean clip_set = FALSE;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
@ -4099,7 +4101,8 @@ clutter_actor_paint (ClutterActor *self,
|
||||
* paint then the last-paint-volume would likely represent the new
|
||||
* actor position not the old.
|
||||
*/
|
||||
if (!in_clone_paint ())
|
||||
culling_inhibited = priv->inhibit_culling_counter > 0;
|
||||
if (!culling_inhibited && !in_clone_paint ())
|
||||
{
|
||||
gboolean success;
|
||||
/* annoyingly gcc warns if uninitialized even though
|
||||
@ -16002,6 +16005,63 @@ clutter_actor_get_opacity_override (ClutterActor *self)
|
||||
return self->priv->opacity_override;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_inhibit_culling:
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Increases the culling inhibitor counter. Inhibiting culling
|
||||
* forces the actor to be painted even when outside the visible
|
||||
* bounds of the stage view.
|
||||
*
|
||||
* This is usually necessary when an actor is being painted on
|
||||
* another paint context.
|
||||
*
|
||||
* Pair with clutter_actor_uninhibit_culling() when the actor doesn't
|
||||
* need to be painted anymore.
|
||||
*/
|
||||
void
|
||||
clutter_actor_inhibit_culling (ClutterActor *actor)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
priv = actor->priv;
|
||||
|
||||
priv->inhibit_culling_counter++;
|
||||
_clutter_actor_set_enable_paint_unmapped (actor, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_uninhibit_culling:
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Decreases the culling inhibitor counter. See clutter_actor_inhibit_culling()
|
||||
* for when inhibit culling is necessary.
|
||||
*
|
||||
* Calling this function without a matching call to
|
||||
* clutter_actor_inhibit_culling() is a programming error.
|
||||
*/
|
||||
void
|
||||
clutter_actor_uninhibit_culling (ClutterActor *actor)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
priv = actor->priv;
|
||||
|
||||
if (priv->inhibit_culling_counter == 0)
|
||||
{
|
||||
g_critical ("Unpaired call to clutter_actor_uninhibit_culling");
|
||||
return;
|
||||
}
|
||||
|
||||
priv->inhibit_culling_counter--;
|
||||
if (priv->inhibit_culling_counter == 0)
|
||||
_clutter_actor_set_enable_paint_unmapped (actor, FALSE);
|
||||
}
|
||||
|
||||
/* Allows you to disable applying the actors model view transform during
|
||||
* a paint. Used by ClutterClone. */
|
||||
void
|
||||
|
@ -884,6 +884,11 @@ void clutter_actor_set_opacity_override
|
||||
CLUTTER_EXPORT
|
||||
gint clutter_actor_get_opacity_override (ClutterActor *self);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_inhibit_culling (ClutterActor *actor);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_uninhibit_culling (ClutterActor *actor);
|
||||
|
||||
/**
|
||||
* ClutterActorCreateChildFunc:
|
||||
* @item: (type GObject): the item in the model
|
||||
|
Loading…
Reference in New Issue
Block a user