stage: Add utility function to queue draw a ClutterRect
Remove duplicated code to clamp to pixel https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
This commit is contained in:
parent
7442de81bb
commit
d7ec5d3022
@ -213,32 +213,35 @@ meta_stage_new (void)
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
queue_redraw_clutter_rect (MetaStage *stage,
|
||||||
|
MetaOverlay *overlay,
|
||||||
|
ClutterRect *rect)
|
||||||
|
{
|
||||||
|
cairo_rectangle_int_t clip = {
|
||||||
|
.x = floorf (rect->origin.x),
|
||||||
|
.y = floorf (rect->origin.y),
|
||||||
|
.width = ceilf (rect->size.width),
|
||||||
|
.height = ceilf (rect->size.height)
|
||||||
|
};
|
||||||
|
|
||||||
|
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stage), &clip);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
queue_redraw_for_overlay (MetaStage *stage,
|
queue_redraw_for_overlay (MetaStage *stage,
|
||||||
MetaOverlay *overlay)
|
MetaOverlay *overlay)
|
||||||
{
|
{
|
||||||
cairo_rectangle_int_t clip;
|
|
||||||
|
|
||||||
/* Clear the location the overlay was at before, if we need to. */
|
/* Clear the location the overlay was at before, if we need to. */
|
||||||
if (overlay->previous_is_valid)
|
if (overlay->previous_is_valid)
|
||||||
{
|
{
|
||||||
clip.x = floorf (overlay->previous_rect.origin.x),
|
queue_redraw_clutter_rect (stage, overlay, &overlay->previous_rect);
|
||||||
clip.y = floorf (overlay->previous_rect.origin.y),
|
|
||||||
clip.width = ceilf (overlay->previous_rect.size.width),
|
|
||||||
clip.height = ceilf (overlay->previous_rect.size.height),
|
|
||||||
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stage), &clip);
|
|
||||||
overlay->previous_is_valid = FALSE;
|
overlay->previous_is_valid = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw the overlay at the new position */
|
/* Draw the overlay at the new position */
|
||||||
if (overlay->enabled)
|
if (overlay->enabled)
|
||||||
{
|
queue_redraw_clutter_rect (stage, overlay, &overlay->current_rect);
|
||||||
clip.x = floorf (overlay->current_rect.origin.x),
|
|
||||||
clip.y = floorf (overlay->current_rect.origin.y),
|
|
||||||
clip.width = ceilf (overlay->current_rect.size.width),
|
|
||||||
clip.height = ceilf (overlay->current_rect.size.height),
|
|
||||||
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stage), &clip);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaOverlay *
|
MetaOverlay *
|
||||||
|
Loading…
Reference in New Issue
Block a user