clutter: Remove ClutterRedrawFlags

ClutterRedrawFlags are a way to give Clutter additional context
about what it needs to redraw. There currently is only one flag defined,
CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION, this flag would clip the redraw to
the actors current allocation.

Since ClutterActor also provides the clip_to_allocation property (which
affects the paint volume of the actor instead of only one redraw), the
additional CLIPPED_TO_ALLOCATION flag seems unnecessary. It's also only
defined to be used privately in Clutter, which it never is, so let's
remove it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1527
This commit is contained in:
Jonas Dreßler 2020-10-19 12:27:25 +02:00
parent 52e2afa2ec
commit 8b21fb4f96
3 changed files with 4 additions and 95 deletions

View File

@ -26,23 +26,6 @@
G_BEGIN_DECLS G_BEGIN_DECLS
/*< private >
* ClutterRedrawFlags:
* @CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION: Tells clutter the maximum
* extents of what needs to be redrawn lies within the actors
* current allocation. (Only use this for 2D actors though because
* any actor with depth may be projected outside of its allocation)
*
* Flags passed to the clutter_actor_queue_redraw_with_clip ()
* function
*
* Since: 1.6
*/
typedef enum
{
CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION = 1 << 0
} ClutterRedrawFlags;
/*< private > /*< private >
* ClutterActorTraverseFlags: * ClutterActorTraverseFlags:
* CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST: Traverse the graph in * CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST: Traverse the graph in
@ -246,10 +229,8 @@ void _clutter_actor_set_has_key_focus
gboolean has_key_focus); gboolean has_key_focus);
void _clutter_actor_queue_redraw_with_clip (ClutterActor *self, void _clutter_actor_queue_redraw_with_clip (ClutterActor *self,
ClutterRedrawFlags flags,
const ClutterPaintVolume *clip_volume); const ClutterPaintVolume *clip_volume);
void _clutter_actor_queue_redraw_full (ClutterActor *self, void _clutter_actor_queue_redraw_full (ClutterActor *self,
ClutterRedrawFlags flags,
const ClutterPaintVolume *volume, const ClutterPaintVolume *volume,
ClutterEffect *effect); ClutterEffect *effect);

View File

@ -1752,7 +1752,7 @@ clutter_actor_queue_redraw_on_parent (ClutterActor *self)
return; return;
pv = clutter_actor_get_transformed_paint_volume (self, self->priv->parent); pv = clutter_actor_get_transformed_paint_volume (self, self->priv->parent);
_clutter_actor_queue_redraw_with_clip (self->priv->parent, 0, pv); _clutter_actor_queue_redraw_with_clip (self->priv->parent, pv);
} }
/** /**
@ -8054,30 +8054,12 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
_clutter_actor_propagate_queue_redraw (self, self, pv); _clutter_actor_propagate_queue_redraw (self, self, pv);
} }
static void
_clutter_actor_get_allocation_clip (ClutterActor *self,
ClutterActorBox *clip)
{
ClutterActorPrivate *priv = self->priv;
/* NB: clutter_actor_queue_redraw_with_clip expects a box in the
* actor's own coordinate space but the allocation is in parent
* coordinates */
clip->x1 = 0;
clip->y1 = 0;
clip->x2 = priv->allocation.x2 - priv->allocation.x1;
clip->y2 = priv->allocation.y2 - priv->allocation.y1;
}
void void
_clutter_actor_queue_redraw_full (ClutterActor *self, _clutter_actor_queue_redraw_full (ClutterActor *self,
ClutterRedrawFlags flags,
const ClutterPaintVolume *volume, const ClutterPaintVolume *volume,
ClutterEffect *effect) ClutterEffect *effect)
{ {
ClutterActorPrivate *priv = self->priv; ClutterActorPrivate *priv = self->priv;
ClutterPaintVolume allocation_pv;
ClutterPaintVolume *pv = NULL;
ClutterActor *stage; ClutterActor *stage;
/* Here's an outline of the actor queue redraw mechanism: /* Here's an outline of the actor queue redraw mechanism:
@ -8185,45 +8167,11 @@ _clutter_actor_queue_redraw_full (ClutterActor *self,
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage)) if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
return; return;
if (flags & CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION)
{
ClutterActorBox allocation_clip;
graphene_point3d_t origin;
/* If the actor doesn't have a valid allocation then we will
* queue a full stage redraw. */
if (priv->needs_allocation)
{
/* NB: NULL denotes an undefined clip which will result in a
* full redraw... */
_clutter_actor_propagate_queue_redraw (self, self, NULL);
return;
}
_clutter_paint_volume_init_static (&allocation_pv, self);
pv = &allocation_pv;
_clutter_actor_get_allocation_clip (self, &allocation_clip);
origin.x = allocation_clip.x1;
origin.y = allocation_clip.y1;
origin.z = 0;
clutter_paint_volume_set_origin (pv, &origin);
clutter_paint_volume_set_width (pv,
allocation_clip.x2 - allocation_clip.x1);
clutter_paint_volume_set_height (pv,
allocation_clip.y2 -
allocation_clip.y1);
}
self->priv->queue_redraw_entry = self->priv->queue_redraw_entry =
_clutter_stage_queue_actor_redraw (CLUTTER_STAGE (stage), _clutter_stage_queue_actor_redraw (CLUTTER_STAGE (stage),
priv->queue_redraw_entry, priv->queue_redraw_entry,
self, self,
pv ? pv : volume); volume);
if (pv)
clutter_paint_volume_free (pv);
/* If this is the first redraw queued then we can directly use the /* If this is the first redraw queued then we can directly use the
effect parameter */ effect parameter */
@ -8293,7 +8241,6 @@ clutter_actor_queue_redraw (ClutterActor *self)
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
_clutter_actor_queue_redraw_full (self, _clutter_actor_queue_redraw_full (self,
0, /* flags */
NULL, /* clip volume */ NULL, /* clip volume */
NULL /* effect */); NULL /* effect */);
} }
@ -8301,27 +8248,13 @@ clutter_actor_queue_redraw (ClutterActor *self)
/*< private > /*< private >
* _clutter_actor_queue_redraw_with_clip: * _clutter_actor_queue_redraw_with_clip:
* @self: A #ClutterActor * @self: A #ClutterActor
* @flags: A mask of #ClutterRedrawFlags controlling the behaviour of
* this queue redraw.
* @volume: A #ClutterPaintVolume describing the bounds of what needs to be * @volume: A #ClutterPaintVolume describing the bounds of what needs to be
* redrawn or %NULL if you are just using a @flag to state your * redrawn or %NULL if to use the actors own paint volume.
* desired clipping.
* *
* Queues up a clipped redraw of an actor and any children. The redraw * Queues up a clipped redraw of an actor and any children. The redraw
* occurs once the main loop becomes idle (after the current batch of * occurs once the main loop becomes idle (after the current batch of
* events has been processed, roughly). * events has been processed, roughly).
* *
* If no flags are given the clip volume is defined by @volume
* specified in actor coordinates and tells Clutter that only content
* within this volume has been changed so Clutter can optionally
* optimize the redraw.
*
* If the %CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION @flag is used, @volume
* should be %NULL and this tells Clutter to use the actor's current
* allocation as a clip box. This flag can only be used for 2D actors,
* because any actor with depth may be projected outside its
* allocation.
*
* Applications rarely need to call this, as redraws are handled * Applications rarely need to call this, as redraws are handled
* automatically by modification functions. * automatically by modification functions.
* *
@ -8337,11 +8270,9 @@ clutter_actor_queue_redraw (ClutterActor *self)
*/ */
void void
_clutter_actor_queue_redraw_with_clip (ClutterActor *self, _clutter_actor_queue_redraw_with_clip (ClutterActor *self,
ClutterRedrawFlags flags,
const ClutterPaintVolume *volume) const ClutterPaintVolume *volume)
{ {
_clutter_actor_queue_redraw_full (self, _clutter_actor_queue_redraw_full (self,
flags, /* flags */
volume, /* clip volume */ volume, /* clip volume */
NULL /* effect */); NULL /* effect */);
} }
@ -8412,7 +8343,7 @@ clutter_actor_queue_redraw_with_clip (ClutterActor *self,
clutter_paint_volume_set_width (&volume, clip->width); clutter_paint_volume_set_width (&volume, clip->width);
clutter_paint_volume_set_height (&volume, clip->height); clutter_paint_volume_set_height (&volume, clip->height);
_clutter_actor_queue_redraw_full (self, 0, &volume, NULL); _clutter_actor_queue_redraw_full (self, &volume, NULL);
clutter_paint_volume_free (&volume); clutter_paint_volume_free (&volume);
} }
@ -10872,7 +10803,6 @@ clutter_actor_set_opacity_internal (ClutterActor *self,
is no flatten effect yet then this is equivalent to queueing is no flatten effect yet then this is equivalent to queueing
a full redraw */ a full redraw */
_clutter_actor_queue_redraw_full (self, _clutter_actor_queue_redraw_full (self,
0, /* flags */
NULL, /* clip */ NULL, /* clip */
priv->flatten_effect); priv->flatten_effect);
@ -11071,7 +11001,6 @@ clutter_actor_set_offscreen_redirect (ClutterActor *self,
still able to continue the paint anyway. If there is no still able to continue the paint anyway. If there is no
effect then this is equivalent to queuing a full redraw */ effect then this is equivalent to queuing a full redraw */
_clutter_actor_queue_redraw_full (self, _clutter_actor_queue_redraw_full (self,
0, /* flags */
NULL, /* clip */ NULL, /* clip */
priv->flatten_effect); priv->flatten_effect);

View File

@ -356,7 +356,6 @@ clutter_effect_queue_repaint (ClutterEffect *effect)
/* If the effect has no actor then nothing needs to be done */ /* If the effect has no actor then nothing needs to be done */
if (actor != NULL) if (actor != NULL)
_clutter_actor_queue_redraw_full (actor, _clutter_actor_queue_redraw_full (actor,
0, /* flags */
NULL, /* clip volume */ NULL, /* clip volume */
effect /* effect */); effect /* effect */);
} }