From 9a843857b352834dba7652c599cd7b5a0e40a608 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 15 Aug 2018 01:12:49 +0200 Subject: [PATCH] clutter: Make paint volume argument const on queue_redraw*() The given paint volume is actually unmodified, there is no need to require non-const arguments when some getters actually give const paint volumes. --- clutter/clutter/clutter-actor-private.h | 14 ++++++------- clutter/clutter/clutter-actor.c | 27 +++++++++---------------- clutter/clutter/clutter-stage-private.h | 2 +- clutter/clutter/clutter-stage.c | 6 +++--- 4 files changed, 21 insertions(+), 28 deletions(-) diff --git a/clutter/clutter/clutter-actor-private.h b/clutter/clutter/clutter-actor-private.h index 4dc767b54..cb77cc455 100644 --- a/clutter/clutter/clutter-actor-private.h +++ b/clutter/clutter/clutter-actor-private.h @@ -275,13 +275,13 @@ void _clutter_actor_set_enable_paint_unmapped void _clutter_actor_set_has_pointer (ClutterActor *self, gboolean has_pointer); -void _clutter_actor_queue_redraw_with_clip (ClutterActor *self, - ClutterRedrawFlags flags, - ClutterPaintVolume *clip_volume); -void _clutter_actor_queue_redraw_full (ClutterActor *self, - ClutterRedrawFlags flags, - ClutterPaintVolume *volume, - ClutterEffect *effect); +void _clutter_actor_queue_redraw_with_clip (ClutterActor *self, + ClutterRedrawFlags flags, + const ClutterPaintVolume *clip_volume); +void _clutter_actor_queue_redraw_full (ClutterActor *self, + ClutterRedrawFlags flags, + const ClutterPaintVolume *volume, + ClutterEffect *effect); ClutterPaintVolume * _clutter_actor_get_queue_redraw_clip (ClutterActor *self); void _clutter_actor_set_queue_redraw_clip (ClutterActor *self, diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index 15e29141d..f455f2b29 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -8744,15 +8744,14 @@ _clutter_actor_get_allocation_clip (ClutterActor *self, } void -_clutter_actor_queue_redraw_full (ClutterActor *self, - ClutterRedrawFlags flags, - ClutterPaintVolume *volume, - ClutterEffect *effect) +_clutter_actor_queue_redraw_full (ClutterActor *self, + ClutterRedrawFlags flags, + const ClutterPaintVolume *volume, + ClutterEffect *effect) { ClutterActorPrivate *priv = self->priv; ClutterPaintVolume allocation_pv; - ClutterPaintVolume *pv; - gboolean should_free_pv; + ClutterPaintVolume *pv = NULL; ClutterActor *stage; /* Here's an outline of the actor queue redraw mechanism: @@ -8894,21 +8893,15 @@ _clutter_actor_queue_redraw_full (ClutterActor *self, clutter_paint_volume_set_height (pv, allocation_clip.y2 - allocation_clip.y1); - should_free_pv = TRUE; - } - else - { - pv = volume; - should_free_pv = FALSE; } self->priv->queue_redraw_entry = _clutter_stage_queue_actor_redraw (CLUTTER_STAGE (stage), priv->queue_redraw_entry, self, - pv); + pv ? pv : volume); - if (should_free_pv) + if (pv) clutter_paint_volume_free (pv); /* If this is the first redraw queued then we can directly use the @@ -9022,9 +9015,9 @@ clutter_actor_queue_redraw (ClutterActor *self) * picking of your actor. */ void -_clutter_actor_queue_redraw_with_clip (ClutterActor *self, - ClutterRedrawFlags flags, - ClutterPaintVolume *volume) +_clutter_actor_queue_redraw_with_clip (ClutterActor *self, + ClutterRedrawFlags flags, + const ClutterPaintVolume *volume) { _clutter_actor_queue_redraw_full (self, flags, /* flags */ diff --git a/clutter/clutter/clutter-stage-private.h b/clutter/clutter/clutter-stage-private.h index 517c9adda..dde8d4e21 100644 --- a/clutter/clutter/clutter-stage-private.h +++ b/clutter/clutter/clutter-stage-private.h @@ -87,7 +87,7 @@ const ClutterPlane *_clutter_stage_get_clip (ClutterStage *stage); ClutterStageQueueRedrawEntry *_clutter_stage_queue_actor_redraw (ClutterStage *stage, ClutterStageQueueRedrawEntry *entry, ClutterActor *actor, - ClutterPaintVolume *clip); + const ClutterPaintVolume *clip); void _clutter_stage_queue_redraw_entry_invalidate (ClutterStageQueueRedrawEntry *entry); CoglFramebuffer *_clutter_stage_get_active_framebuffer (ClutterStage *stage); diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index 8fa92dd7f..e4f692456 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -4145,10 +4145,10 @@ _clutter_stage_get_clip (ClutterStage *stage) * didn't explicitly do so. */ ClutterStageQueueRedrawEntry * -_clutter_stage_queue_actor_redraw (ClutterStage *stage, +_clutter_stage_queue_actor_redraw (ClutterStage *stage, ClutterStageQueueRedrawEntry *entry, - ClutterActor *actor, - ClutterPaintVolume *clip) + ClutterActor *actor, + const ClutterPaintVolume *clip) { ClutterStagePrivate *priv = stage->priv;