mirror of
https://github.com/brl/mutter.git
synced 2025-02-16 21:34:09 +00:00
Remove internal usage of ClutterGeometry in StageWindow
The ClutterGeometry type is a poor substitute of cairo_rectangle_int_t, with unsigned integers for width and height to complicate matters. Let's remove the internal usage of ClutterGeometry and switch to the rectangle type from Cairo. https://bugzilla.gnome.org/show_bug.cgi?id=656663
This commit is contained in:
parent
c59f9ef79f
commit
1776ac8ed5
@ -235,6 +235,10 @@ void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
|
|||||||
ClutterVertex *vertices_out,
|
ClutterVertex *vertices_out,
|
||||||
int n_vertices);
|
int n_vertices);
|
||||||
|
|
||||||
|
void _clutter_util_rectangle_union (const cairo_rectangle_int_t *src1,
|
||||||
|
const cairo_rectangle_int_t *src2,
|
||||||
|
cairo_rectangle_int_t *dest);
|
||||||
|
|
||||||
typedef struct _ClutterPlane
|
typedef struct _ClutterPlane
|
||||||
{
|
{
|
||||||
CoglVector3 v0;
|
CoglVector3 v0;
|
||||||
|
@ -35,8 +35,10 @@ typedef struct _ClutterStageQueueRedrawEntry ClutterStageQueueRedrawEntry;
|
|||||||
|
|
||||||
/* stage */
|
/* stage */
|
||||||
ClutterStageWindow *_clutter_stage_get_default_window (void);
|
ClutterStageWindow *_clutter_stage_get_default_window (void);
|
||||||
void _clutter_stage_do_paint (ClutterStage *stage,
|
|
||||||
const ClutterGeometry *clip);
|
void _clutter_stage_do_paint (ClutterStage *stage,
|
||||||
|
const cairo_rectangle_int_t *clip);
|
||||||
|
|
||||||
void _clutter_stage_set_window (ClutterStage *stage,
|
void _clutter_stage_set_window (ClutterStage *stage,
|
||||||
ClutterStageWindow *stage_window);
|
ClutterStageWindow *stage_window);
|
||||||
ClutterStageWindow *_clutter_stage_get_window (ClutterStage *stage);
|
ClutterStageWindow *_clutter_stage_get_window (ClutterStage *stage);
|
||||||
|
@ -95,8 +95,8 @@ _clutter_stage_window_resize (ClutterStageWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_clutter_stage_window_get_geometry (ClutterStageWindow *window,
|
_clutter_stage_window_get_geometry (ClutterStageWindow *window,
|
||||||
ClutterGeometry *geometry)
|
cairo_rectangle_int_t *geometry)
|
||||||
{
|
{
|
||||||
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->get_geometry (window, geometry);
|
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->get_geometry (window, geometry);
|
||||||
}
|
}
|
||||||
@ -119,15 +119,15 @@ _clutter_stage_window_get_pending_swaps (ClutterStageWindow *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
|
_clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
|
||||||
ClutterGeometry *stage_clip)
|
cairo_rectangle_int_t *stage_clip)
|
||||||
{
|
{
|
||||||
ClutterStageWindowIface *iface;
|
ClutterStageWindowIface *iface;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
||||||
|
|
||||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||||
if (iface->add_redraw_clip)
|
if (iface->add_redraw_clip != NULL)
|
||||||
iface->add_redraw_clip (window, stage_clip);
|
iface->add_redraw_clip (window, stage_clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ _clutter_stage_window_has_redraw_clips (ClutterStageWindow *window)
|
|||||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||||
|
|
||||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||||
if (iface->has_redraw_clips)
|
if (iface->has_redraw_clips != NULL)
|
||||||
return iface->has_redraw_clips (window);
|
return iface->has_redraw_clips (window);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -169,7 +169,7 @@ _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window)
|
|||||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||||
|
|
||||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||||
if (iface->ignoring_redraw_clips)
|
if (iface->ignoring_redraw_clips != NULL)
|
||||||
return iface->ignoring_redraw_clips (window);
|
return iface->ignoring_redraw_clips (window);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -184,7 +184,7 @@ _clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
|
|||||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||||
|
|
||||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||||
if (iface->get_redraw_clip_bounds)
|
if (iface->get_redraw_clip_bounds != NULL)
|
||||||
return iface->get_redraw_clip_bounds (window, stage_clip);
|
return iface->get_redraw_clip_bounds (window, stage_clip);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -57,15 +57,15 @@ struct _ClutterStageWindowIface
|
|||||||
gint width,
|
gint width,
|
||||||
gint height);
|
gint height);
|
||||||
void (* get_geometry) (ClutterStageWindow *stage_window,
|
void (* get_geometry) (ClutterStageWindow *stage_window,
|
||||||
ClutterGeometry *geometry);
|
cairo_rectangle_int_t *geometry);
|
||||||
|
|
||||||
int (* get_pending_swaps) (ClutterStageWindow *stage_window);
|
int (* get_pending_swaps) (ClutterStageWindow *stage_window);
|
||||||
|
|
||||||
void (* add_redraw_clip) (ClutterStageWindow *stage_window,
|
void (* add_redraw_clip) (ClutterStageWindow *stage_window,
|
||||||
ClutterGeometry *stage_rectangle);
|
cairo_rectangle_int_t *stage_rectangle);
|
||||||
gboolean (* has_redraw_clips) (ClutterStageWindow *stage_window);
|
gboolean (* has_redraw_clips) (ClutterStageWindow *stage_window);
|
||||||
gboolean (* ignoring_redraw_clips) (ClutterStageWindow *stage_window);
|
gboolean (* ignoring_redraw_clips) (ClutterStageWindow *stage_window);
|
||||||
gboolean (* get_redraw_clip_bounds) (ClutterStageWindow *stage_window,
|
gboolean (* get_redraw_clip_bounds) (ClutterStageWindow *stage_window,
|
||||||
cairo_rectangle_int_t *clip);
|
cairo_rectangle_int_t *clip);
|
||||||
|
|
||||||
|
|
||||||
@ -101,18 +101,18 @@ void _clutter_stage_window_resize (ClutterStageWin
|
|||||||
gint width,
|
gint width,
|
||||||
gint height);
|
gint height);
|
||||||
void _clutter_stage_window_get_geometry (ClutterStageWindow *window,
|
void _clutter_stage_window_get_geometry (ClutterStageWindow *window,
|
||||||
ClutterGeometry *geometry);
|
cairo_rectangle_int_t *geometry);
|
||||||
int _clutter_stage_window_get_pending_swaps (ClutterStageWindow *window);
|
int _clutter_stage_window_get_pending_swaps (ClutterStageWindow *window);
|
||||||
|
|
||||||
void _clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
|
void _clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
|
||||||
ClutterGeometry *stage_clip);
|
cairo_rectangle_int_t *stage_clip);
|
||||||
gboolean _clutter_stage_window_has_redraw_clips (ClutterStageWindow *window);
|
gboolean _clutter_stage_window_has_redraw_clips (ClutterStageWindow *window);
|
||||||
gboolean _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window);
|
gboolean _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window);
|
||||||
gboolean _clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
|
gboolean _clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
|
||||||
cairo_rectangle_int_t *clip);
|
cairo_rectangle_int_t *clip);
|
||||||
|
|
||||||
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
|
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
|
||||||
gboolean accept_focus);
|
gboolean accept_focus);
|
||||||
|
|
||||||
void _clutter_stage_window_redraw (ClutterStageWindow *window);
|
void _clutter_stage_window_redraw (ClutterStageWindow *window);
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ clutter_stage_get_preferred_width (ClutterActor *self,
|
|||||||
gfloat *natural_width_p)
|
gfloat *natural_width_p)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
||||||
ClutterGeometry geom = { 0, };
|
cairo_rectangle_int_t geom;
|
||||||
|
|
||||||
if (priv->impl == NULL)
|
if (priv->impl == NULL)
|
||||||
return;
|
return;
|
||||||
@ -246,7 +246,7 @@ clutter_stage_get_preferred_height (ClutterActor *self,
|
|||||||
gfloat *natural_height_p)
|
gfloat *natural_height_p)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
||||||
ClutterGeometry geom = { 0, };
|
cairo_rectangle_int_t geom;
|
||||||
|
|
||||||
if (priv->impl == NULL)
|
if (priv->impl == NULL)
|
||||||
return;
|
return;
|
||||||
@ -287,25 +287,32 @@ clutter_stage_allocate (ClutterActor *self,
|
|||||||
ClutterAllocationFlags flags)
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
||||||
ClutterGeometry prev_geom;
|
ClutterGeometry prev_geom, geom;
|
||||||
ClutterGeometry geom = { 0, };
|
cairo_rectangle_int_t window_size;
|
||||||
gboolean origin_changed;
|
gboolean origin_changed;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
|
||||||
origin_changed = (flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED) ? TRUE : FALSE;
|
origin_changed = (flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED)
|
||||||
|
? TRUE
|
||||||
|
: FALSE;
|
||||||
|
|
||||||
if (priv->impl == NULL)
|
if (priv->impl == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* our old allocation */
|
||||||
clutter_actor_get_allocation_geometry (self, &prev_geom);
|
clutter_actor_get_allocation_geometry (self, &prev_geom);
|
||||||
|
|
||||||
|
/* the current allocation */
|
||||||
width = clutter_actor_box_get_width (box);
|
width = clutter_actor_box_get_width (box);
|
||||||
height = clutter_actor_box_get_height (box);
|
height = clutter_actor_box_get_height (box);
|
||||||
_clutter_stage_window_get_geometry (priv->impl, &geom);
|
|
||||||
|
|
||||||
/* if the stage is fixed size (for instance, it's using a frame-buffer)
|
/* the current Stage implementation size */
|
||||||
|
_clutter_stage_window_get_geometry (priv->impl, &window_size);
|
||||||
|
|
||||||
|
/* if the stage is fixed size (for instance, it's using a EGL framebuffer)
|
||||||
* then we simply ignore any allocation request and override the
|
* then we simply ignore any allocation request and override the
|
||||||
* allocation chain.
|
* allocation chain - because we cannot forcibly change the size of the
|
||||||
|
* stage window.
|
||||||
*/
|
*/
|
||||||
if ((!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC)))
|
if ((!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC)))
|
||||||
{
|
{
|
||||||
@ -347,8 +354,11 @@ clutter_stage_allocate (ClutterActor *self,
|
|||||||
priv->min_size_changed = FALSE;
|
priv->min_size_changed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((geom.width != width) || (geom.height != height))
|
if (window_size.width != width ||
|
||||||
_clutter_stage_window_resize (priv->impl, width, height);
|
window_size.height != height)
|
||||||
|
{
|
||||||
|
_clutter_stage_window_resize (priv->impl, width, height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -356,10 +366,11 @@ clutter_stage_allocate (ClutterActor *self,
|
|||||||
ClutterActorBox override = { 0, };
|
ClutterActorBox override = { 0, };
|
||||||
ClutterActorClass *klass;
|
ClutterActorClass *klass;
|
||||||
|
|
||||||
|
/* override the passed allocation */
|
||||||
override.x1 = 0;
|
override.x1 = 0;
|
||||||
override.y1 = 0;
|
override.y1 = 0;
|
||||||
override.x2 = geom.width;
|
override.x2 = window_size.width;
|
||||||
override.y2 = geom.height;
|
override.y2 = window_size.height;
|
||||||
|
|
||||||
CLUTTER_NOTE (LAYOUT,
|
CLUTTER_NOTE (LAYOUT,
|
||||||
"Overrigin original allocation of %dx%d "
|
"Overrigin original allocation of %dx%d "
|
||||||
@ -378,19 +389,26 @@ clutter_stage_allocate (ClutterActor *self,
|
|||||||
* Clutter need to manually keep it informed of the current window
|
* Clutter need to manually keep it informed of the current window
|
||||||
* size. We do this after the allocation above so that the stage
|
* size. We do this after the allocation above so that the stage
|
||||||
* window has a chance to update the window size based on the
|
* window has a chance to update the window size based on the
|
||||||
* allocation. */
|
* allocation.
|
||||||
_clutter_stage_window_get_geometry (priv->impl, &geom);
|
*/
|
||||||
cogl_onscreen_clutter_backend_set_size (geom.width, geom.height);
|
_clutter_stage_window_get_geometry (priv->impl, &window_size);
|
||||||
|
cogl_onscreen_clutter_backend_set_size (window_size.width,
|
||||||
|
window_size.height);
|
||||||
|
|
||||||
|
/* reset the viewport if the allocation effectively changed */
|
||||||
clutter_actor_get_allocation_geometry (self, &geom);
|
clutter_actor_get_allocation_geometry (self, &geom);
|
||||||
if (geom.width != prev_geom.width || geom.height != prev_geom.height)
|
if (geom.width != prev_geom.width ||
|
||||||
|
geom.height != prev_geom.height)
|
||||||
{
|
{
|
||||||
_clutter_stage_set_viewport (CLUTTER_STAGE (self),
|
_clutter_stage_set_viewport (CLUTTER_STAGE (self),
|
||||||
0, 0, geom.width, geom.height);
|
0, 0,
|
||||||
|
geom.width,
|
||||||
|
geom.height);
|
||||||
|
|
||||||
/* Note: we don't assume that set_viewport will queue a full redraw
|
/* Note: we don't assume that set_viewport will queue a full redraw
|
||||||
* since it may bail-out early if something preemptively set the
|
* since it may bail-out early if something preemptively set the
|
||||||
* viewport before the stage was really allocated its new size. */
|
* viewport before the stage was really allocated its new size.
|
||||||
|
*/
|
||||||
queue_full_redraw (CLUTTER_STAGE (self));
|
queue_full_redraw (CLUTTER_STAGE (self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -525,11 +543,12 @@ _clutter_stage_update_active_framebuffer (ClutterStage *stage)
|
|||||||
* be able to cull them.
|
* be able to cull them.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_clutter_stage_do_paint (ClutterStage *stage, const ClutterGeometry *clip)
|
_clutter_stage_do_paint (ClutterStage *stage,
|
||||||
|
const cairo_rectangle_int_t *clip)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = stage->priv;
|
ClutterStagePrivate *priv = stage->priv;
|
||||||
float clip_poly[8];
|
float clip_poly[8];
|
||||||
ClutterGeometry geom;
|
cairo_rectangle_int_t geom;
|
||||||
|
|
||||||
_clutter_stage_window_get_geometry (priv->impl, &geom);
|
_clutter_stage_window_get_geometry (priv->impl, &geom);
|
||||||
|
|
||||||
@ -761,7 +780,7 @@ static void
|
|||||||
clutter_stage_real_fullscreen (ClutterStage *stage)
|
clutter_stage_real_fullscreen (ClutterStage *stage)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = stage->priv;
|
ClutterStagePrivate *priv = stage->priv;
|
||||||
ClutterGeometry geom;
|
cairo_rectangle_int_t geom;
|
||||||
ClutterActorBox box;
|
ClutterActorBox box;
|
||||||
|
|
||||||
/* we need to force an allocation here because the size
|
/* we need to force an allocation here because the size
|
||||||
@ -1114,11 +1133,10 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
|
|||||||
{
|
{
|
||||||
ClutterStage *stage = CLUTTER_STAGE (actor);
|
ClutterStage *stage = CLUTTER_STAGE (actor);
|
||||||
ClutterStageWindow *stage_window;
|
ClutterStageWindow *stage_window;
|
||||||
ClutterGeometry stage_clip;
|
|
||||||
ClutterPaintVolume *redraw_clip;
|
ClutterPaintVolume *redraw_clip;
|
||||||
ClutterActorBox bounding_box;
|
ClutterActorBox bounding_box;
|
||||||
ClutterActorBox intersection_box;
|
ClutterActorBox intersection_box;
|
||||||
ClutterGeometry geom;
|
cairo_rectangle_int_t geom, stage_clip;
|
||||||
|
|
||||||
if (CLUTTER_ACTOR_IN_DESTRUCTION (actor))
|
if (CLUTTER_ACTOR_IN_DESTRUCTION (actor))
|
||||||
return;
|
return;
|
||||||
@ -1219,14 +1237,8 @@ clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
|
|||||||
|
|
||||||
if (!_clutter_stage_window_get_redraw_clip_bounds (priv->impl, clip))
|
if (!_clutter_stage_window_get_redraw_clip_bounds (priv->impl, clip))
|
||||||
{
|
{
|
||||||
ClutterGeometry geometry;
|
|
||||||
|
|
||||||
/* Set clip to the full extents of the stage */
|
/* Set clip to the full extents of the stage */
|
||||||
_clutter_stage_window_get_geometry (priv->impl, &geometry);
|
_clutter_stage_window_get_geometry (priv->impl, clip);
|
||||||
clip->x = 0;
|
|
||||||
clip->y = 0;
|
|
||||||
clip->width = geometry.width;
|
|
||||||
clip->height = geometry.height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2026,7 +2038,7 @@ clutter_stage_init (ClutterStage *self)
|
|||||||
{
|
{
|
||||||
ClutterStagePrivate *priv;
|
ClutterStagePrivate *priv;
|
||||||
ClutterBackend *backend;
|
ClutterBackend *backend;
|
||||||
ClutterGeometry geom;
|
cairo_rectangle_int_t geom;
|
||||||
|
|
||||||
/* a stage is a top-level object */
|
/* a stage is a top-level object */
|
||||||
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IS_TOPLEVEL);
|
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IS_TOPLEVEL);
|
||||||
|
@ -148,3 +148,33 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* _clutter_util_rectangle_union:
|
||||||
|
* @src1: first rectangle to union
|
||||||
|
* @src2: second rectangle to union
|
||||||
|
* @dest: (out): return location for the unioned rectangle
|
||||||
|
*
|
||||||
|
* Calculates the union of two rectangles.
|
||||||
|
*
|
||||||
|
* The union of rectangles @src1 and @src2 is the smallest rectangle which
|
||||||
|
* includes both @src1 and @src2 within it.
|
||||||
|
*
|
||||||
|
* It is allowed for @dest to be the same as either @src1 or @src2.
|
||||||
|
*
|
||||||
|
* This function should really be in Cairo.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
_clutter_util_rectangle_union (const cairo_rectangle_int_t *src1,
|
||||||
|
const cairo_rectangle_int_t *src2,
|
||||||
|
cairo_rectangle_int_t *dest)
|
||||||
|
{
|
||||||
|
int dest_x, dest_y;
|
||||||
|
|
||||||
|
dest_x = MIN (src1->x, src2->x);
|
||||||
|
dest_y = MIN (src1->y, src2->y);
|
||||||
|
|
||||||
|
dest->width = MAX (src1->x + src1->width, src2->x + src2->width) - dest_x;
|
||||||
|
dest->height = MAX (src1->y + src1->height, src2->y + src2->height) - dest_y;
|
||||||
|
dest->x = dest_x;
|
||||||
|
dest->y = dest_y;
|
||||||
|
}
|
||||||
|
@ -205,8 +205,8 @@ clutter_stage_cogl_hide (ClutterStageWindow *stage_window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_cogl_get_geometry (ClutterStageWindow *stage_window,
|
clutter_stage_cogl_get_geometry (ClutterStageWindow *stage_window,
|
||||||
ClutterGeometry *geometry)
|
cairo_rectangle_int_t *geometry)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||||
|
|
||||||
@ -288,8 +288,8 @@ clutter_stage_cogl_ignoring_redraw_clips (ClutterStageWindow *stage_window)
|
|||||||
* buffer.
|
* buffer.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
|
clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
|
||||||
ClutterGeometry *stage_clip)
|
cairo_rectangle_int_t *stage_clip)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||||
|
|
||||||
@ -313,32 +313,27 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
|
|||||||
|
|
||||||
if (!stage_cogl->initialized_redraw_clip)
|
if (!stage_cogl->initialized_redraw_clip)
|
||||||
{
|
{
|
||||||
stage_cogl->bounding_redraw_clip.x = stage_clip->x;
|
stage_cogl->bounding_redraw_clip = *stage_clip;
|
||||||
stage_cogl->bounding_redraw_clip.y = stage_clip->y;
|
|
||||||
stage_cogl->bounding_redraw_clip.width = stage_clip->width;
|
|
||||||
stage_cogl->bounding_redraw_clip.height = stage_clip->height;
|
|
||||||
}
|
}
|
||||||
else if (stage_cogl->bounding_redraw_clip.width > 0)
|
else if (stage_cogl->bounding_redraw_clip.width > 0)
|
||||||
{
|
{
|
||||||
clutter_geometry_union (&stage_cogl->bounding_redraw_clip, stage_clip,
|
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
|
||||||
&stage_cogl->bounding_redraw_clip);
|
stage_clip,
|
||||||
|
&stage_cogl->bounding_redraw_clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
stage_cogl->initialized_redraw_clip = TRUE;
|
stage_cogl->initialized_redraw_clip = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
clutter_stage_cogl_get_redraw_clip_bounds (ClutterStageWindow *stage_window,
|
clutter_stage_cogl_get_redraw_clip_bounds (ClutterStageWindow *stage_window,
|
||||||
cairo_rectangle_int_t *stage_clip)
|
cairo_rectangle_int_t *stage_clip)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||||
|
|
||||||
if (stage_cogl->using_clipped_redraw)
|
if (stage_cogl->using_clipped_redraw)
|
||||||
{
|
{
|
||||||
stage_clip->x = stage_cogl->bounding_redraw_clip.x;
|
*stage_clip = stage_cogl->bounding_redraw_clip;
|
||||||
stage_clip->y = stage_cogl->bounding_redraw_clip.y;
|
|
||||||
stage_clip->width = stage_cogl->bounding_redraw_clip.width;
|
|
||||||
stage_clip->height = stage_cogl->bounding_redraw_clip.height;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -457,7 +452,7 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
|||||||
G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)))
|
G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)))
|
||||||
{
|
{
|
||||||
static CoglMaterial *outline = NULL;
|
static CoglMaterial *outline = NULL;
|
||||||
ClutterGeometry *clip = &stage_cogl->bounding_redraw_clip;
|
cairo_rectangle_int_t *clip = &stage_cogl->bounding_redraw_clip;
|
||||||
ClutterActor *actor = CLUTTER_ACTOR (wrapper);
|
ClutterActor *actor = CLUTTER_ACTOR (wrapper);
|
||||||
CoglHandle vbo;
|
CoglHandle vbo;
|
||||||
float x_1 = clip->x;
|
float x_1 = clip->x;
|
||||||
@ -504,7 +499,7 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
|||||||
/* push on the screen */
|
/* push on the screen */
|
||||||
if (use_clipped_redraw)
|
if (use_clipped_redraw)
|
||||||
{
|
{
|
||||||
ClutterGeometry *clip = &stage_cogl->bounding_redraw_clip;
|
cairo_rectangle_int_t *clip = &stage_cogl->bounding_redraw_clip;
|
||||||
int copy_area[4];
|
int copy_area[4];
|
||||||
|
|
||||||
/* XXX: It seems there will be a race here in that the stage
|
/* XXX: It seems there will be a race here in that the stage
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
#include <cairo.h>
|
||||||
#include <clutter/clutter-stage.h>
|
#include <clutter/clutter-stage.h>
|
||||||
|
|
||||||
#ifdef COGL_HAS_X11_SUPPORT
|
#ifdef COGL_HAS_X11_SUPPORT
|
||||||
@ -57,7 +58,7 @@ struct _ClutterStageCogl
|
|||||||
* junk frames to start with. */
|
* junk frames to start with. */
|
||||||
unsigned long frame_count;
|
unsigned long frame_count;
|
||||||
|
|
||||||
ClutterGeometry bounding_redraw_clip;
|
cairo_rectangle_int_t bounding_redraw_clip;
|
||||||
|
|
||||||
guint initialized_redraw_clip : 1;
|
guint initialized_redraw_clip : 1;
|
||||||
|
|
||||||
|
@ -434,8 +434,8 @@ clutter_stage_osx_hide (ClutterStageWindow *stage_window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_osx_get_geometry (ClutterStageWindow *stage_window,
|
clutter_stage_osx_get_geometry (ClutterStageWindow *stage_window,
|
||||||
ClutterGeometry *geometry)
|
cairo_rectangle_int_t *geometry)
|
||||||
{
|
{
|
||||||
ClutterBackend *backend = clutter_get_default_backend ();
|
ClutterBackend *backend = clutter_get_default_backend ();
|
||||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
||||||
|
@ -91,7 +91,7 @@ get_visual (struct wl_display *display, CoglPixelFormat format)
|
|||||||
}
|
}
|
||||||
static ClutterStageWaylandWaylandBuffer *
|
static ClutterStageWaylandWaylandBuffer *
|
||||||
wayland_create_shm_buffer (ClutterBackendWayland *backend_wayland,
|
wayland_create_shm_buffer (ClutterBackendWayland *backend_wayland,
|
||||||
ClutterGeometry *geom)
|
cairo_rectangle_int_t *geom)
|
||||||
{
|
{
|
||||||
ClutterStageWaylandWaylandBufferSHM *buffer;
|
ClutterStageWaylandWaylandBufferSHM *buffer;
|
||||||
struct wl_visual *visual;
|
struct wl_visual *visual;
|
||||||
@ -105,9 +105,9 @@ wayland_create_shm_buffer (ClutterBackendWayland *backend_wayland,
|
|||||||
|
|
||||||
buffer->buffer.type = BUFFER_TYPE_SHM;
|
buffer->buffer.type = BUFFER_TYPE_SHM;
|
||||||
|
|
||||||
tex = cogl_texture_new_with_size ((unsigned int)geom->width,
|
tex = cogl_texture_new_with_size ((unsigned int) geom->width,
|
||||||
(unsigned int)geom->height,
|
(unsigned int) geom->height,
|
||||||
flags, format);
|
flags, format);
|
||||||
buffer->format = format;
|
buffer->format = format;
|
||||||
buffer->stride = cogl_texture_get_rowstride(tex);
|
buffer->stride = cogl_texture_get_rowstride(tex);
|
||||||
buffer->size = cogl_texture_get_data(tex, format, buffer->stride, NULL);
|
buffer->size = cogl_texture_get_data(tex, format, buffer->stride, NULL);
|
||||||
@ -134,7 +134,7 @@ wayland_create_shm_buffer (ClutterBackendWayland *backend_wayland,
|
|||||||
|
|
||||||
static ClutterStageWaylandWaylandBuffer *
|
static ClutterStageWaylandWaylandBuffer *
|
||||||
wayland_create_drm_buffer (ClutterBackendWayland *backend_wayland,
|
wayland_create_drm_buffer (ClutterBackendWayland *backend_wayland,
|
||||||
ClutterGeometry *geom)
|
cairo_rectangle_int_t *geom)
|
||||||
{
|
{
|
||||||
EGLDisplay edpy = clutter_wayland_get_egl_display ();
|
EGLDisplay edpy = clutter_wayland_get_egl_display ();
|
||||||
struct wl_visual *visual;
|
struct wl_visual *visual;
|
||||||
@ -181,7 +181,7 @@ wayland_create_drm_buffer (ClutterBackendWayland *backend_wayland,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ClutterStageWaylandWaylandBuffer *
|
static ClutterStageWaylandWaylandBuffer *
|
||||||
wayland_create_buffer (ClutterGeometry *geom)
|
wayland_create_buffer (cairo_rectangle_int_t *geom)
|
||||||
{
|
{
|
||||||
ClutterBackend *backend = clutter_get_default_backend ();
|
ClutterBackend *backend = clutter_get_default_backend ();
|
||||||
ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
|
ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
|
||||||
@ -346,13 +346,14 @@ clutter_stage_wayland_hide (ClutterStageWindow *stage_window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_wayland_get_geometry (ClutterStageWindow *stage_window,
|
clutter_stage_wayland_get_geometry (ClutterStageWindow *stage_window,
|
||||||
ClutterGeometry *geometry)
|
cairo_rectangle_int_t *geometry)
|
||||||
{
|
{
|
||||||
ClutterStageWayland *stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window);
|
if (geometry != NULL)
|
||||||
|
|
||||||
if (geometry)
|
|
||||||
{
|
{
|
||||||
|
ClutterStageWayland *stage_wayland =
|
||||||
|
CLUTTER_STAGE_WAYLAND (stage_window);
|
||||||
|
|
||||||
*geometry = stage_wayland->allocation;
|
*geometry = stage_wayland->allocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,7 +364,6 @@ clutter_stage_wayland_resize (ClutterStageWindow *stage_window,
|
|||||||
gint height)
|
gint height)
|
||||||
{
|
{
|
||||||
ClutterStageWayland *stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window);
|
ClutterStageWayland *stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window);
|
||||||
cairo_rectangle_int_t rect;
|
|
||||||
|
|
||||||
fprintf (stderr, "resize %dx%d\n", width, height);
|
fprintf (stderr, "resize %dx%d\n", width, height);
|
||||||
|
|
||||||
@ -371,11 +371,8 @@ clutter_stage_wayland_resize (ClutterStageWindow *stage_window,
|
|||||||
stage_wayland->pending_allocation.height = height;
|
stage_wayland->pending_allocation.height = height;
|
||||||
|
|
||||||
/* FIXME: Shouldn't the stage repaint everything when it gets resized? */
|
/* FIXME: Shouldn't the stage repaint everything when it gets resized? */
|
||||||
rect.x = stage_wayland->pending_allocation.x;
|
cairo_region_union_rectangle (stage_wayland->repaint_region,
|
||||||
rect.y = stage_wayland->pending_allocation.y;
|
&stage_wayland->pending_allocation);
|
||||||
rect.width = stage_wayland->pending_allocation.width;
|
|
||||||
rect.height = stage_wayland->pending_allocation.height;
|
|
||||||
cairo_region_union_rectangle (stage_wayland->repaint_region, &rect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CAIRO_REGION_FULL ((cairo_region_t *) 1)
|
#define CAIRO_REGION_FULL ((cairo_region_t *) 1)
|
||||||
@ -393,26 +390,16 @@ clutter_stage_wayland_ignoring_redraw_clips (ClutterStageWindow *stage_window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_wayland_add_redraw_clip (ClutterStageWindow *stage_window,
|
clutter_stage_wayland_add_redraw_clip (ClutterStageWindow *stage_window,
|
||||||
ClutterGeometry *stage_clip)
|
cairo_rectangle_int_t *stage_clip)
|
||||||
{
|
{
|
||||||
ClutterStageWayland *stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window);
|
ClutterStageWayland *stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window);
|
||||||
cairo_rectangle_int_t rect;
|
cairo_rectangle_int_t rect;
|
||||||
|
|
||||||
if (stage_clip == NULL)
|
if (stage_clip == NULL)
|
||||||
{
|
rect = stage_wayland->allocation;
|
||||||
rect.x = stage_wayland->allocation.x;
|
|
||||||
rect.y = stage_wayland->allocation.y;
|
|
||||||
rect.width = stage_wayland->allocation.width;
|
|
||||||
rect.height = stage_wayland->allocation.height;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
rect = stage_clip;
|
||||||
rect.x = stage_clip->x;
|
|
||||||
rect.y = stage_clip->y;
|
|
||||||
rect.width = stage_clip->width;
|
|
||||||
rect.height = stage_clip->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stage_wayland->repaint_region == NULL)
|
if (stage_wayland->repaint_region == NULL)
|
||||||
stage_wayland->repaint_region = cairo_region_create_rectangle (&rect);
|
stage_wayland->repaint_region = cairo_region_create_rectangle (&rect);
|
||||||
@ -606,7 +593,6 @@ void
|
|||||||
_clutter_stage_wayland_repaint_region (ClutterStageWayland *stage_wayland,
|
_clutter_stage_wayland_repaint_region (ClutterStageWayland *stage_wayland,
|
||||||
ClutterStage *stage)
|
ClutterStage *stage)
|
||||||
{
|
{
|
||||||
ClutterGeometry geom;
|
|
||||||
cairo_rectangle_int_t rect;
|
cairo_rectangle_int_t rect;
|
||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
@ -615,13 +601,11 @@ _clutter_stage_wayland_repaint_region (ClutterStageWayland *stage_wayland,
|
|||||||
{
|
{
|
||||||
cairo_region_get_rectangle (stage_wayland->repaint_region, i, &rect);
|
cairo_region_get_rectangle (stage_wayland->repaint_region, i, &rect);
|
||||||
|
|
||||||
cogl_clip_push_window_rectangle (rect.x - 1, rect.y - 1,
|
cogl_clip_push_window_rectangle (rect.x - 1,
|
||||||
rect.width + 2, rect.height + 2);
|
rect.y - 1,
|
||||||
|
rect.width + 2,
|
||||||
|
rect.height + 2);
|
||||||
|
|
||||||
geom.x = rect.x;
|
|
||||||
geom.y = rect.y;
|
|
||||||
geom.width = rect.width;
|
|
||||||
geom.height = rect.height;
|
|
||||||
/* FIXME: We should pass geom in as second arg, but some actors
|
/* FIXME: We should pass geom in as second arg, but some actors
|
||||||
* cull themselves a little to much. Disable for now.*/
|
* cull themselves a little to much. Disable for now.*/
|
||||||
_clutter_stage_do_paint (stage, NULL);
|
_clutter_stage_do_paint (stage, NULL);
|
||||||
@ -637,8 +621,10 @@ _clutter_stage_wayland_redraw (ClutterStageWayland *stage_wayland,
|
|||||||
stage_wayland->allocation = stage_wayland->pending_allocation;
|
stage_wayland->allocation = stage_wayland->pending_allocation;
|
||||||
|
|
||||||
if (!stage_wayland->back_buffer)
|
if (!stage_wayland->back_buffer)
|
||||||
|
{
|
||||||
stage_wayland->back_buffer =
|
stage_wayland->back_buffer =
|
||||||
wayland_create_buffer (&stage_wayland->allocation);
|
wayland_create_buffer (&stage_wayland->allocation);
|
||||||
|
}
|
||||||
|
|
||||||
cogl_set_framebuffer (stage_wayland->back_buffer->offscreen);
|
cogl_set_framebuffer (stage_wayland->back_buffer->offscreen);
|
||||||
_clutter_stage_maybe_setup_viewport (stage_wayland->wrapper);
|
_clutter_stage_maybe_setup_viewport (stage_wayland->wrapper);
|
||||||
|
@ -89,9 +89,9 @@ struct _ClutterStageWayland
|
|||||||
/* back pointer to the backend */
|
/* back pointer to the backend */
|
||||||
ClutterBackendWayland *backend;
|
ClutterBackendWayland *backend;
|
||||||
|
|
||||||
ClutterGeometry allocation;
|
cairo_rectangle_int_t allocation;
|
||||||
ClutterGeometry save_allocation;
|
cairo_rectangle_int_t save_allocation;
|
||||||
ClutterGeometry pending_allocation;
|
cairo_rectangle_int_t pending_allocation;
|
||||||
struct wl_surface *wayland_surface;
|
struct wl_surface *wayland_surface;
|
||||||
int pending_swaps;
|
int pending_swaps;
|
||||||
|
|
||||||
|
@ -79,17 +79,17 @@ clutter_stage_win32_hide (ClutterStageWindow *stage_window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_win32_get_geometry (ClutterStageWindow *stage_window,
|
clutter_stage_win32_get_geometry (ClutterStageWindow *stage_window,
|
||||||
ClutterGeometry *geometry)
|
cairo_rectangle_int_t *geometry)
|
||||||
{
|
{
|
||||||
ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (stage_window);
|
ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (stage_window);
|
||||||
|
|
||||||
if ((stage_win32->state & CLUTTER_STAGE_STATE_FULLSCREEN))
|
if ((stage_win32->state & CLUTTER_STAGE_STATE_FULLSCREEN))
|
||||||
{
|
{
|
||||||
geometry->width = (stage_win32->fullscreen_rect.right
|
geometry->width = stage_win32->fullscreen_rect.right
|
||||||
- stage_win32->fullscreen_rect.left);
|
- stage_win32->fullscreen_rect.left;
|
||||||
geometry->height = (stage_win32->fullscreen_rect.bottom
|
geometry->height = stage_win32->fullscreen_rect.bottom
|
||||||
- stage_win32->fullscreen_rect.top);
|
- stage_win32->fullscreen_rect.top;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,8 +193,8 @@ clutter_stage_x11_set_wm_protocols (ClutterStageX11 *stage_x11)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
|
clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
|
||||||
ClutterGeometry *geometry)
|
cairo_rectangle_int_t *geometry)
|
||||||
{
|
{
|
||||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user