actor: Add queue_redraw_with_clip()

Add a public version of the clipped queue redraw, using a 2D clip. This
allows implementing actors with trackable 2D clipped regions, like the
ClutterX11TexturePixmap, outside of Clutter itself.

https://bugzilla.gnome.org/show_bug.cgi?id=660997
This commit is contained in:
Emmanuele Bassi 2011-10-31 11:53:45 +00:00
parent c3639fd798
commit f0a246cdc6
3 changed files with 49 additions and 2 deletions

View File

@ -5696,8 +5696,8 @@ clutter_actor_queue_redraw (ClutterActor *self)
NULL /* effect */);
}
/*
* clutter_actor_queue_redraw_with_clip:
/*< private >
* _clutter_actor_queue_redraw_with_clip:
* @self: A #ClutterActor
* @flags: A mask of #ClutterRedrawFlags controlling the behaviour of
* this queue redraw.
@ -5770,6 +5770,49 @@ _clutter_actor_queue_only_relayout (ClutterActor *self)
g_signal_emit (self, actor_signals[QUEUE_RELAYOUT], 0);
}
/**
* clutter_actor_queue_redraw_with_clip:
* @self: a #ClutterActor
* @clip: (allow-none): a rectangular clip region, or %NULL
*
* Queues a redraw on @self limited to a specific, actor-relative
* rectangular area.
*
* If @clip is %NULL this function is equivalent to
* clutter_actor_queue_redraw().
*
* Since: 1.10
*/
void
clutter_actor_queue_redraw_with_clip (ClutterActor *self,
const cairo_rectangle_int_t *clip)
{
ClutterPaintVolume volume;
ClutterVertex origin;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
if (clip == NULL)
{
clutter_actor_queue_redraw (self);
return;
}
_clutter_paint_volume_init_static (&volume, self);
origin.x = clip->x;
origin.y = clip->y;
origin.z = 0.0f;
clutter_paint_volume_set_origin (&volume, &origin);
clutter_paint_volume_set_width (&volume, clip->width);
clutter_paint_volume_set_height (&volume, clip->height);
_clutter_actor_queue_redraw_full (self, 0, &volume, NULL);
clutter_paint_volume_free (&volume);
}
/**
* clutter_actor_queue_relayout:
* @self: A #ClutterActor

View File

@ -280,6 +280,8 @@ void clutter_actor_unmap (ClutterActor
void clutter_actor_paint (ClutterActor *self);
void clutter_actor_continue_paint (ClutterActor *self);
void clutter_actor_queue_redraw (ClutterActor *self);
void clutter_actor_queue_redraw_with_clip (ClutterActor *self,
const cairo_rectangle_int_t *clip);
void clutter_actor_queue_relayout (ClutterActor *self);
void clutter_actor_destroy (ClutterActor *self);

View File

@ -28,6 +28,8 @@
#ifndef __CLUTTER_TYPES_H__
#define __CLUTTER_TYPES_H__
#include <cairo.h>
#include <clutter/clutter-enums.h>
G_BEGIN_DECLS