actor: Use a cairo_rectangle_t instead of a ridiculous array
Make the code maintainable and readable.
This commit is contained in:
parent
ea7111333b
commit
71545ae56f
@ -374,13 +374,8 @@ struct _ClutterActorPrivate
|
|||||||
/* depth */
|
/* depth */
|
||||||
gfloat z;
|
gfloat z;
|
||||||
|
|
||||||
/* clip, in actor coordinates; offsets are:
|
/* clip, in actor coordinates */
|
||||||
* 0: x
|
cairo_rectangle_t clip;
|
||||||
* 1: y
|
|
||||||
* 2: width
|
|
||||||
* 3: height
|
|
||||||
*/
|
|
||||||
gfloat clip[4];
|
|
||||||
|
|
||||||
/* the cached transformation matrix; see apply_transform() */
|
/* the cached transformation matrix; see apply_transform() */
|
||||||
CoglMatrix transform;
|
CoglMatrix transform;
|
||||||
@ -2991,10 +2986,10 @@ clutter_actor_paint (ClutterActor *self)
|
|||||||
|
|
||||||
if (priv->has_clip)
|
if (priv->has_clip)
|
||||||
{
|
{
|
||||||
cogl_clip_push_rectangle (priv->clip[0],
|
cogl_clip_push_rectangle (priv->clip.x,
|
||||||
priv->clip[1],
|
priv->clip.y,
|
||||||
priv->clip[0] + priv->clip[2],
|
priv->clip.x + priv->clip.width,
|
||||||
priv->clip[1] + priv->clip[3]);
|
priv->clip.y + priv->clip.height);
|
||||||
clip_set = TRUE;
|
clip_set = TRUE;
|
||||||
}
|
}
|
||||||
else if (priv->clip_to_allocation)
|
else if (priv->clip_to_allocation)
|
||||||
@ -3953,12 +3948,12 @@ clutter_actor_get_property (GObject *object,
|
|||||||
|
|
||||||
case PROP_CLIP:
|
case PROP_CLIP:
|
||||||
{
|
{
|
||||||
ClutterGeometry clip = { 0, };
|
ClutterGeometry clip;
|
||||||
|
|
||||||
clip.x = priv->clip[0];
|
clip.x = CLUTTER_NEARBYINT (priv->clip.x);
|
||||||
clip.y = priv->clip[1];
|
clip.y = CLUTTER_NEARBYINT (priv->clip.y);
|
||||||
clip.width = priv->clip[2];
|
clip.width = CLUTTER_NEARBYINT (priv->clip.width);
|
||||||
clip.height = priv->clip[3];
|
clip.height = CLUTTER_NEARBYINT (priv->clip.height);
|
||||||
|
|
||||||
g_value_set_boxed (value, &clip);
|
g_value_set_boxed (value, &clip);
|
||||||
}
|
}
|
||||||
@ -4368,13 +4363,13 @@ clutter_actor_real_get_paint_volume (ClutterActor *self,
|
|||||||
{
|
{
|
||||||
ClutterVertex origin;
|
ClutterVertex origin;
|
||||||
|
|
||||||
origin.x = priv->clip[0];
|
origin.x = priv->clip.x;
|
||||||
origin.y = priv->clip[1];
|
origin.y = priv->clip.y;
|
||||||
origin.z = 0;
|
origin.z = 0;
|
||||||
|
|
||||||
clutter_paint_volume_set_origin (volume, &origin);
|
clutter_paint_volume_set_origin (volume, &origin);
|
||||||
clutter_paint_volume_set_width (volume, priv->clip[2]);
|
clutter_paint_volume_set_width (volume, priv->clip.width);
|
||||||
clutter_paint_volume_set_height (volume, priv->clip[3]);
|
clutter_paint_volume_set_height (volume, priv->clip.height);
|
||||||
|
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
}
|
}
|
||||||
@ -6025,8 +6020,6 @@ clutter_actor_init (ClutterActor *self)
|
|||||||
priv->last_paint_volume_valid = TRUE;
|
priv->last_paint_volume_valid = TRUE;
|
||||||
|
|
||||||
priv->transform_valid = FALSE;
|
priv->transform_valid = FALSE;
|
||||||
|
|
||||||
memset (priv->clip, 0, sizeof (gfloat) * 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9220,16 +9213,16 @@ clutter_actor_set_clip (ClutterActor *self,
|
|||||||
priv = self->priv;
|
priv = self->priv;
|
||||||
|
|
||||||
if (priv->has_clip &&
|
if (priv->has_clip &&
|
||||||
priv->clip[0] == xoff &&
|
priv->clip.x == xoff &&
|
||||||
priv->clip[1] == yoff &&
|
priv->clip.y == yoff &&
|
||||||
priv->clip[2] == width &&
|
priv->clip.width == width &&
|
||||||
priv->clip[3] == height)
|
priv->clip.height == height)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
priv->clip[0] = xoff;
|
priv->clip.x = xoff;
|
||||||
priv->clip[1] = yoff;
|
priv->clip.y = yoff;
|
||||||
priv->clip[2] = width;
|
priv->clip.width = width;
|
||||||
priv->clip[3] = height;
|
priv->clip.height = height;
|
||||||
|
|
||||||
priv->has_clip = TRUE;
|
priv->has_clip = TRUE;
|
||||||
|
|
||||||
@ -9310,17 +9303,17 @@ clutter_actor_get_clip (ClutterActor *self,
|
|||||||
if (!priv->has_clip)
|
if (!priv->has_clip)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (xoff)
|
if (xoff != NULL)
|
||||||
*xoff = priv->clip[0];
|
*xoff = priv->clip.x;
|
||||||
|
|
||||||
if (yoff)
|
if (yoff != NULL)
|
||||||
*yoff = priv->clip[1];
|
*yoff = priv->clip.y;
|
||||||
|
|
||||||
if (width)
|
if (width != NULL)
|
||||||
*width = priv->clip[2];
|
*width = priv->clip.width;
|
||||||
|
|
||||||
if (height)
|
if (height != NULL)
|
||||||
*height = priv->clip[3];
|
*height = priv->clip.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user