Replace ClutterRect by graphene_rect_t

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
This commit is contained in:
Georges Basile Stavracas Neto 2019-02-20 12:23:04 -03:00
parent eb10b79cb0
commit 13cac6bcf8
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385
44 changed files with 229 additions and 938 deletions

View File

@ -694,7 +694,7 @@ struct _ClutterActorPrivate
ClutterAllocationFlags allocation_flags;
/* clip, in actor coordinates */
ClutterRect clip;
graphene_rect_t clip;
/* the cached transformation matrix; see apply_transform() */
CoglMatrix transform;
@ -5018,7 +5018,7 @@ clutter_actor_set_anchor_coord (ClutterActor *self,
static void
clutter_actor_set_clip_rect (ClutterActor *self,
const ClutterRect *clip)
const graphene_rect_t *clip)
{
ClutterActorPrivate *priv = self->priv;
GObject *obj = G_OBJECT (self);
@ -6922,7 +6922,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
* ClutterActor:clip-rect:
*
* The visible region of the actor, in actor-relative coordinates,
* expressed as a #ClutterRect.
* expressed as a #graphene_rect_t.
*
* Setting this property to %NULL will unset the existing clip.
*
@ -6935,7 +6935,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_boxed ("clip-rect",
P_("Clip Rectangle"),
P_("The visible region of the actor"),
CLUTTER_TYPE_RECT,
GRAPHENE_TYPE_RECT,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
@ -17741,7 +17741,7 @@ clutter_actor_get_paint_box (ClutterActor *self,
static gboolean
_clutter_actor_get_resource_scale_for_rect (ClutterActor *self,
ClutterRect *bounding_rect,
graphene_rect_t *bounding_rect,
float *resource_scale)
{
ClutterActor *stage;
@ -17765,7 +17765,7 @@ static gboolean
_clutter_actor_compute_resource_scale (ClutterActor *self,
float *resource_scale)
{
ClutterRect bounding_rect;
graphene_rect_t bounding_rect;
ClutterActorPrivate *priv = self->priv;
if (CLUTTER_ACTOR_IN_DESTRUCTION (self) ||

View File

@ -94,7 +94,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRect, clutter_rect_free)
#endif /* __GI_SCANNER__ */

View File

@ -68,7 +68,7 @@ clutter_geometry_free (ClutterGeometry *geometry)
*
* Since: 1.4
*
* Deprecated: 1.16: Use #ClutterRect and clutter_rect_union()
* Deprecated: 1.16: Use #graphene_rect_t and graphene_rect_union()
*/
void
clutter_geometry_union (const ClutterGeometry *geometry_a,
@ -102,7 +102,7 @@ clutter_geometry_union (const ClutterGeometry *geometry_a,
*
* Since: 1.4
*
* Deprecated: 1.16: Use #ClutterRect and clutter_rect_intersection()
* Deprecated: 1.16: Use #graphene_rect_t and graphene_rect_intersection()
*/
gboolean
clutter_geometry_intersects (const ClutterGeometry *geometry0,
@ -210,616 +210,6 @@ G_DEFINE_BOXED_TYPE (ClutterMargin, clutter_margin,
clutter_margin_copy,
clutter_margin_free)
/*
* ClutterRect
*/
static const ClutterRect _clutter_rect_zero = CLUTTER_RECT_INIT_ZERO;
static gboolean clutter_rect_progress (const GValue *a,
const GValue *b,
gdouble progress,
GValue *res);
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterRect, clutter_rect,
clutter_rect_copy,
clutter_rect_free,
CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_rect_progress))
static inline void
clutter_rect_normalize_internal (ClutterRect *rect)
{
if (rect->size.width >= 0.f && rect->size.height >= 0.f)
return;
if (rect->size.width < 0.f)
{
float size = fabsf (rect->size.width);
rect->origin.x -= size;
rect->size.width = size;
}
if (rect->size.height < 0.f)
{
float size = fabsf (rect->size.height);
rect->origin.y -= size;
rect->size.height = size;
}
}
/**
* clutter_rect_zero:
*
* A #ClutterRect with #ClutterRect.origin set at (0, 0) and a size
* of 0.
*
* The returned value can be used as a guard.
*
* Return value: a rectangle with origin in (0, 0) and a size of 0.
* The returned #ClutterRect is owned by Clutter and it should not
* be modified or freed.
*
* Since: 1.12
*/
const ClutterRect *
clutter_rect_zero (void)
{
return &_clutter_rect_zero;
}
/**
* clutter_rect_alloc: (constructor)
*
* Creates a new, empty #ClutterRect.
*
* You can use clutter_rect_init() to initialize the returned rectangle,
* for instance:
*
* |[
* rect = clutter_rect_init (clutter_rect_alloc (), x, y, width, height);
* ]|
*
* Return value: (transfer full): the newly allocated #ClutterRect.
* Use clutter_rect_free() to free its resources
*
* Since: 1.12
*/
ClutterRect *
clutter_rect_alloc (void)
{
return g_slice_new0 (ClutterRect);
}
/**
* clutter_rect_init:
* @rect: a #ClutterRect
* @x: X coordinate of the origin
* @y: Y coordinate of the origin
* @width: width of the rectangle
* @height: height of the rectangle
*
* Initializes a #ClutterRect with the given origin and size.
*
* Return value: (transfer none): the updated rectangle
*
* Since: 1.12
*/
ClutterRect *
clutter_rect_init (ClutterRect *rect,
float x,
float y,
float width,
float height)
{
g_return_val_if_fail (rect != NULL, NULL);
rect->origin.x = x;
rect->origin.y = y;
rect->size.width = width;
rect->size.height = height;
return rect;
}
/**
* clutter_rect_copy:
* @rect: a #ClutterRect
*
* Copies @rect into a new #ClutterRect instance.
*
* Return value: (transfer full): the newly allocate copy of @rect.
* Use clutter_rect_free() to free the associated resources
*
* Since: 1.12
*/
ClutterRect *
clutter_rect_copy (const ClutterRect *rect)
{
if (rect != NULL)
{
ClutterRect *res;
res = g_slice_dup (ClutterRect, rect);
clutter_rect_normalize_internal (res);
return res;
}
return NULL;
}
/**
* clutter_rect_free:
* @rect: a #ClutterRect
*
* Frees the resources allocated by @rect.
*
* Since: 1.12
*/
void
clutter_rect_free (ClutterRect *rect)
{
if (rect != NULL && rect != &_clutter_rect_zero)
g_slice_free (ClutterRect, rect);
}
/**
* clutter_rect_equals:
* @a: a #ClutterRect
* @b: a #ClutterRect
*
* Checks whether @a and @b are equals.
*
* This function will normalize both @a and @b before comparing
* their origin and size.
*
* Return value: %TRUE if the rectangles match in origin and size.
*
* Since: 1.12
*/
gboolean
clutter_rect_equals (ClutterRect *a,
ClutterRect *b)
{
if (a == b)
return TRUE;
if (a == NULL || b == NULL)
return FALSE;
clutter_rect_normalize_internal (a);
clutter_rect_normalize_internal (b);
return graphene_point_equal (&a->origin, &b->origin) &&
graphene_size_equal (&a->size, &b->size);
}
/**
* clutter_rect_normalize:
* @rect: a #ClutterRect
*
* Normalizes a #ClutterRect.
*
* A #ClutterRect is defined by the area covered by its size; this means
* that a #ClutterRect with #ClutterRect.origin in [ 0, 0 ] and a
* #ClutterRect.size of [ 10, 10 ] is equivalent to a #ClutterRect with
* #ClutterRect.origin in [ 10, 10 ] and a #ClutterRect.size of [ -10, -10 ].
*
* This function is useful to ensure that a rectangle has positive width
* and height; it will modify the passed @rect and normalize its size.
*
* Since: 1.12
*/
ClutterRect *
clutter_rect_normalize (ClutterRect *rect)
{
g_return_val_if_fail (rect != NULL, NULL);
clutter_rect_normalize_internal (rect);
return rect;
}
/**
* clutter_rect_get_center:
* @rect: a #ClutterRect
* @center: (out caller-allocates): a #graphene_point_t
*
* Retrieves the center of @rect, after normalizing the rectangle,
* and updates @center with the correct coordinates.
*
* Since: 1.12
*/
void
clutter_rect_get_center (ClutterRect *rect,
graphene_point_t *center)
{
g_return_if_fail (rect != NULL);
g_return_if_fail (center != NULL);
clutter_rect_normalize_internal (rect);
center->x = rect->origin.x + (rect->size.width / 2.0f);
center->y = rect->origin.y + (rect->size.height / 2.0f);
}
/**
* clutter_rect_contains_point:
* @rect: a #ClutterRect
* @point: the point to check
*
* Checks whether @point is contained by @rect, after normalizing the
* rectangle.
*
* Return value: %TRUE if the @point is contained by @rect.
*
* Since: 1.12
*/
gboolean
clutter_rect_contains_point (ClutterRect *rect,
graphene_point_t *point)
{
g_return_val_if_fail (rect != NULL, FALSE);
g_return_val_if_fail (point != NULL, FALSE);
clutter_rect_normalize_internal (rect);
return (point->x >= rect->origin.x) &&
(point->y >= rect->origin.y) &&
(point->x <= (rect->origin.x + rect->size.width)) &&
(point->y <= (rect->origin.y + rect->size.height));
}
/**
* clutter_rect_contains_rect:
* @a: a #ClutterRect
* @b: a #ClutterRect
*
* Checks whether @a contains @b.
*
* The first rectangle contains the second if the union of the
* two #ClutterRect is equal to the first rectangle.
*
* Return value: %TRUE if the first rectangle contains the second.
*
* Since: 1.12
*/
gboolean
clutter_rect_contains_rect (ClutterRect *a,
ClutterRect *b)
{
ClutterRect res;
g_return_val_if_fail (a != NULL, FALSE);
g_return_val_if_fail (b != NULL, FALSE);
clutter_rect_union (a, b, &res);
return clutter_rect_equals (a, &res);
}
/**
* clutter_rect_union:
* @a: a #ClutterRect
* @b: a #ClutterRect
* @res: (out caller-allocates): a #ClutterRect
*
* Computes the smallest possible rectangle capable of fully containing
* both @a and @b, and places it into @res.
*
* This function will normalize both @a and @b prior to computing their
* union.
*
* Since: 1.12
*/
void
clutter_rect_union (ClutterRect *a,
ClutterRect *b,
ClutterRect *res)
{
g_return_if_fail (a != NULL);
g_return_if_fail (b != NULL);
g_return_if_fail (res != NULL);
clutter_rect_normalize_internal (a);
clutter_rect_normalize_internal (b);
res->origin.x = MIN (a->origin.x, b->origin.x);
res->origin.y = MIN (a->origin.y, b->origin.y);
res->size.width = MAX (a->size.width, b->size.width);
res->size.height = MAX (a->size.height, b->size.height);
}
/**
* clutter_rect_intersection:
* @a: a #ClutterRect
* @b: a #ClutterRect
* @res: (out caller-allocates) (allow-none): a #ClutterRect, or %NULL
*
* Computes the intersection of @a and @b, and places it in @res, if @res
* is not %NULL.
*
* This function will normalize both @a and @b prior to computing their
* intersection.
*
* This function can be used to simply check if the intersection of @a and @b
* is not empty, by using %NULL for @res.
*
* Return value: %TRUE if the intersection of @a and @b is not empty
*
* Since: 1.12
*/
gboolean
clutter_rect_intersection (ClutterRect *a,
ClutterRect *b,
ClutterRect *res)
{
float x_1, y_1, x_2, y_2;
g_return_val_if_fail (a != NULL, FALSE);
g_return_val_if_fail (b != NULL, FALSE);
clutter_rect_normalize_internal (a);
clutter_rect_normalize_internal (b);
x_1 = MAX (a->origin.x, b->origin.x);
y_1 = MAX (a->origin.y, b->origin.y);
x_2 = MIN (a->origin.x + a->size.width, b->origin.x + b->size.width);
y_2 = MIN (a->origin.y + a->size.height, b->origin.y + b->size.height);
if (x_1 >= x_2 || y_1 >= y_2)
{
if (res != NULL)
clutter_rect_init (res, 0.f, 0.f, 0.f, 0.f);
return FALSE;
}
if (res != NULL)
clutter_rect_init (res, x_1, y_1, x_2 - x_1, y_2 - y_1);
return TRUE;
}
/**
* clutter_rect_offset:
* @rect: a #ClutterRect
* @d_x: the horizontal offset value
* @d_y: the vertical offset value
*
* Offsets the origin of @rect by the given values, after normalizing
* the rectangle.
*
* Since: 1.12
*/
void
clutter_rect_offset (ClutterRect *rect,
float d_x,
float d_y)
{
g_return_if_fail (rect != NULL);
clutter_rect_normalize_internal (rect);
rect->origin.x += d_x;
rect->origin.y += d_y;
}
/**
* clutter_rect_inset:
* @rect: a #ClutterRect
* @d_x: an horizontal value; a positive @d_x will create an inset rectangle,
* and a negative value will create a larger rectangle
* @d_y: a vertical value; a positive @d_x will create an inset rectangle,
* and a negative value will create a larger rectangle
*
* Normalizes the @rect and offsets its origin by the @d_x and @d_y values;
* the size is adjusted by (2 * @d_x, 2 * @d_y).
*
* If @d_x and @d_y are positive the size of the rectangle is decreased; if
* the values are negative, the size of the rectangle is increased.
*
* If the resulting rectangle has a negative width or height, the size is
* set to 0.
*
* Since: 1.12
*/
void
clutter_rect_inset (ClutterRect *rect,
float d_x,
float d_y)
{
g_return_if_fail (rect != NULL);
clutter_rect_normalize_internal (rect);
rect->origin.x += d_x;
rect->origin.y += d_y;
if (d_x >= 0.f)
rect->size.width -= (d_x * 2.f);
else
rect->size.width += (d_x * -2.f);
if (d_y >= 0.f)
rect->size.height -= (d_y * 2.f);
else
rect->size.height += (d_y * -2.f);
if (rect->size.width < 0.f)
rect->size.width = 0.f;
if (rect->size.height < 0.f)
rect->size.height = 0.f;
}
/**
* clutter_rect_scale:
* @rect: a #ClutterRect
* @s_x: an horizontal scale value
* @s_y: a vertical scale value
*
* Scale the rectangle coordinates and size by @s_x horizontally and
* @s_y vertically.
*/
void
clutter_rect_scale (ClutterRect *rect,
float s_x,
float s_y)
{
g_return_if_fail (rect != NULL);
g_return_if_fail (s_x > 0.f);
g_return_if_fail (s_y > 0.f);
clutter_rect_normalize_internal (rect);
rect->origin.x *= s_x;
rect->origin.y *= s_y;
rect->size.width *= s_x;
rect->size.height *= s_y;
}
/**
* clutter_rect_clamp_to_pixel:
* @rect: a #ClutterRect
*
* Rounds the origin of @rect downwards to the nearest integer, and recompute the
* the size using the @rect origin and size rounded upwards to the nearest integer,
* so that @rect is updated to the smallest rectangle capable of fully containing
* the original, fractional rectangle in the coordinates space.
*
* Since: 1.12
*/
void
clutter_rect_clamp_to_pixel (ClutterRect *rect)
{
float x2, y2;
g_return_if_fail (rect != NULL);
clutter_rect_normalize_internal (rect);
x2 = rect->origin.x + rect->size.width;
y2 = rect->origin.y + rect->size.height;
rect->origin.x = floorf (rect->origin.x);
rect->origin.y = floorf (rect->origin.y);
rect->size.width = ceilf (x2) - rect->origin.x;
rect->size.height = ceilf (y2) - rect->origin.y;
}
/**
* clutter_rect_get_x:
* @rect: a #ClutterRect
*
* Retrieves the X coordinate of the origin of @rect.
*
* Return value: the X coordinate of the origin of the rectangle
*
* Since: 1.12
*/
float
clutter_rect_get_x (ClutterRect *rect)
{
g_return_val_if_fail (rect != NULL, 0.f);
clutter_rect_normalize_internal (rect);
return rect->origin.x;
}
/**
* clutter_rect_get_y:
* @rect: a #ClutterRect
*
* Retrieves the Y coordinate of the origin of @rect.
*
* Return value: the Y coordinate of the origin of the rectangle
*
* Since: 1.12
*/
float
clutter_rect_get_y (ClutterRect *rect)
{
g_return_val_if_fail (rect != NULL, 0.f);
clutter_rect_normalize_internal (rect);
return rect->origin.y;
}
/**
* clutter_rect_get_width:
* @rect: a #ClutterRect
*
* Retrieves the width of @rect.
*
* Return value: the width of the rectangle
*
* Since: 1.12
*/
float
clutter_rect_get_width (ClutterRect *rect)
{
g_return_val_if_fail (rect != NULL, 0.f);
clutter_rect_normalize_internal (rect);
return rect->size.width;
}
/**
* clutter_rect_get_height:
* @rect: a #ClutterRect
*
* Retrieves the height of @rect.
*
* Return value: the height of the rectangle
*
* Since: 1.12
*/
float
clutter_rect_get_height (ClutterRect *rect)
{
g_return_val_if_fail (rect != NULL, 0.f);
clutter_rect_normalize_internal (rect);
return rect->size.height;
}
static gboolean
clutter_rect_progress (const GValue *a,
const GValue *b,
gdouble progress,
GValue *retval)
{
const ClutterRect *rect_a = g_value_get_boxed (a);
const ClutterRect *rect_b = g_value_get_boxed (b);
ClutterRect res = CLUTTER_RECT_INIT_ZERO;
#define INTERPOLATE(r_a,r_b,member,field,factor) ((r_a)->member.field + (((r_b)->member.field - ((r_a)->member.field)) * (factor)))
res.origin.x = INTERPOLATE (rect_a, rect_b, origin, x, progress);
res.origin.y = INTERPOLATE (rect_a, rect_b, origin, y, progress);
res.size.width = INTERPOLATE (rect_a, rect_b, size, width, progress);
res.size.height = INTERPOLATE (rect_a, rect_b, size, height, progress);
#undef INTERPOLATE
g_value_set_boxed (retval, &res);
return TRUE;
}
/**
* ClutterMatrix:
*

View File

@ -177,7 +177,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
if (priv->is_dirty)
{
ClutterRect rect;
graphene_rect_t rect;
gboolean mapped_buffer;
CoglVertexP3T2C4 *verts;
ClutterActor *actor;
@ -193,8 +193,8 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
*/
if (clutter_offscreen_effect_get_target_rect (effect, &rect))
{
width = clutter_rect_get_width (&rect);
height = clutter_rect_get_height (&rect);
width = graphene_rect_get_width (&rect);
height = graphene_rect_get_height (&rect);
}
else
clutter_actor_get_size (actor, &width, &height);

View File

@ -81,7 +81,7 @@ struct _ClutterDragActionPrivate
gint y_drag_threshold;
ClutterActor *drag_handle;
ClutterDragAxis drag_axis;
ClutterRect drag_area;
graphene_rect_t drag_area;
ClutterInputDevice *device;
ClutterEventSequence *sequence;
@ -542,7 +542,7 @@ clutter_drag_action_real_drag_motion (ClutterDragAction *action,
if (action->priv->drag_area_set)
{
ClutterRect *drag_area = &action->priv->drag_area;
graphene_rect_t *drag_area = &action->priv->drag_area;
x = CLAMP (x, drag_area->origin.x, drag_area->origin.x + drag_area->size.width);
y = CLAMP (y, drag_area->origin.y, drag_area->origin.y + drag_area->size.height);
@ -811,7 +811,7 @@ clutter_drag_action_class_init (ClutterDragActionClass *klass)
g_param_spec_boxed ("drag-area",
P_("Drag Area"),
P_("Constrains the dragging to a rectangle"),
CLUTTER_TYPE_RECT,
GRAPHENE_TYPE_RECT,
CLUTTER_PARAM_READWRITE);
/**
@ -1267,10 +1267,10 @@ clutter_drag_action_get_motion_coords (ClutterDragAction *action,
/**
* clutter_drag_action_get_drag_area:
* @action: a #ClutterDragAction
* @drag_area: (out caller-allocates): a #ClutterRect to be filled
* @drag_area: (out caller-allocates): a #graphene_rect_t to be filled
*
* Retrieves the "drag area" associated with @action, that
* is a #ClutterRect that constrains the actor movements,
* is a #graphene_rect_t that constrains the actor movements,
* in parents coordinates.
*
* Returns: %TRUE if the actor is actually constrained (and thus
@ -1278,7 +1278,7 @@ clutter_drag_action_get_motion_coords (ClutterDragAction *action,
*/
gboolean
clutter_drag_action_get_drag_area (ClutterDragAction *action,
ClutterRect *drag_area)
graphene_rect_t *drag_area)
{
g_return_val_if_fail (CLUTTER_IS_DRAG_ACTION (action), FALSE);
@ -1299,7 +1299,7 @@ clutter_drag_action_get_drag_area (ClutterDragAction *action,
*/
void
clutter_drag_action_set_drag_area (ClutterDragAction *action,
const ClutterRect *drag_area)
const graphene_rect_t *drag_area)
{
ClutterDragActionPrivate *priv;

View File

@ -141,11 +141,11 @@ void clutter_drag_action_get_motion_coords (ClutterDragAction *actio
CLUTTER_EXPORT
gboolean clutter_drag_action_get_drag_area (ClutterDragAction *action,
ClutterRect *drag_area);
graphene_rect_t *drag_area);
CLUTTER_EXPORT
void clutter_drag_action_set_drag_area (ClutterDragAction *action,
const ClutterRect *drag_area);
const graphene_rect_t *drag_area);
G_END_DECLS

View File

@ -60,6 +60,23 @@ graphene_point3d_progress (const GValue *a,
return TRUE;
}
static gboolean
graphene_rect_progress (const GValue *a,
const GValue *b,
gdouble progress,
GValue *retval)
{
const graphene_rect_t *rect_a = g_value_get_boxed (a);
const graphene_rect_t *rect_b = g_value_get_boxed (b);
graphene_rect_t res;
graphene_rect_interpolate (rect_a, rect_b, progress, &res);
g_value_set_boxed (retval, &res);
return TRUE;
}
static gboolean
graphene_size_progress (const GValue *a,
const GValue *b,
@ -84,6 +101,8 @@ clutter_graphene_init (void)
graphene_point_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT3D,
graphene_point3d_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_RECT,
graphene_rect_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_SIZE,
graphene_size_progress);
}

View File

@ -90,7 +90,7 @@ clutter_input_focus_reset (ClutterInputFocus *focus)
void
clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const ClutterRect *rect)
const graphene_rect_t *rect)
{
ClutterInputFocusPrivate *priv;

View File

@ -58,7 +58,7 @@ CLUTTER_EXPORT
void clutter_input_focus_reset (ClutterInputFocus *focus);
CLUTTER_EXPORT
void clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const ClutterRect *rect);
const graphene_rect_t *rect);
CLUTTER_EXPORT
void clutter_input_focus_set_surrounding (ClutterInputFocus *focus,

View File

@ -27,7 +27,7 @@ ClutterInputFocus * clutter_input_method_get_focus (ClutterInputMethod *method);
void clutter_input_method_reset (ClutterInputMethod *method);
void clutter_input_method_set_cursor_location (ClutterInputMethod *method,
const ClutterRect *rect);
const graphene_rect_t *rect);
void clutter_input_method_set_surrounding (ClutterInputMethod *method,
const gchar *text,
guint cursor,

View File

@ -187,7 +187,7 @@ clutter_input_method_class_init (ClutterInputMethodClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 1, CLUTTER_TYPE_RECT);
G_TYPE_NONE, 1, GRAPHENE_TYPE_RECT);
pspecs[PROP_CONTENT_HINTS] =
g_param_spec_flags ("content-hints",
@ -378,7 +378,7 @@ clutter_input_method_reset (ClutterInputMethod *im)
void
clutter_input_method_set_cursor_location (ClutterInputMethod *im,
const ClutterRect *rect)
const graphene_rect_t *rect)
{
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));

View File

@ -43,7 +43,7 @@ struct _ClutterInputMethodClass
void (* reset) (ClutterInputMethod *im);
void (* set_cursor_location) (ClutterInputMethod *im,
const ClutterRect *rect);
const graphene_rect_t *rect);
void (* set_surrounding) (ClutterInputMethod *im,
const gchar *text,
guint cursor,

View File

@ -684,7 +684,7 @@ clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
*/
gboolean
clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
ClutterRect *rect)
graphene_rect_t *rect)
{
ClutterOffscreenEffectPrivate *priv;
@ -696,7 +696,7 @@ clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
if (priv->texture == NULL)
return FALSE;
clutter_rect_init (rect,
graphene_rect_init (rect,
priv->position.x,
priv->position.y,
cogl_texture_get_width (priv->texture),

View File

@ -114,7 +114,7 @@ gboolean clutter_offscreen_effect_get_target_size (ClutterOffscree
CLUTTER_EXPORT
gboolean clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
ClutterRect *rect);
graphene_rect_t *rect);
G_END_DECLS

View File

@ -247,9 +247,9 @@ void _clutter_util_fully_transform_vertices (const CoglMatrix *modelvie
int n_vertices);
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
ClutterRect *dest);
graphene_rect_t *dest);
void _clutter_util_rectangle_int_extents (const ClutterRect *src,
void _clutter_util_rectangle_int_extents (const graphene_rect_t *src,
cairo_rectangle_int_t *dest);
void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,

View File

@ -418,9 +418,9 @@ clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
*/
void
clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
const ClutterRect *rect)
const graphene_rect_t *rect)
{
ClutterRect n_rect;
graphene_rect_t n_rect;
g_return_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor));
g_return_if_fail (rect != NULL);
@ -428,7 +428,7 @@ clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
n_rect = *rect;
/* normalize, so that we have a valid origin */
clutter_rect_normalize (&n_rect);
graphene_rect_normalize (&n_rect);
clutter_scroll_actor_scroll_to_point (actor, &n_rect.origin);
}

View File

@ -90,7 +90,7 @@ void clutter_scroll_actor_scroll_to_point (ClutterScrollAc
const graphene_point_t *point);
CLUTTER_EXPORT
void clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
const ClutterRect *rect);
const graphene_rect_t *rect);
G_END_DECLS

View File

@ -125,7 +125,7 @@ gboolean _clutter_stage_update_state (ClutterStage *stag
void _clutter_stage_set_scale_factor (ClutterStage *stage,
int factor);
gboolean _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
ClutterRect *rect,
graphene_rect_t *rect,
float *view_scale);
void _clutter_stage_presented (ClutterStage *stage,

View File

@ -4668,7 +4668,7 @@ clutter_stage_get_capture_final_size (ClutterStage *stage,
if (rect)
{
ClutterRect capture_rect;
graphene_rect_t capture_rect;
_clutter_util_rect_from_rectangle (rect, &capture_rect);
if (!_clutter_stage_get_max_view_scale_factor_for_rect (stage,
@ -4876,7 +4876,7 @@ clutter_stage_update_resource_scales (ClutterStage *stage)
gboolean
_clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
ClutterRect *rect,
graphene_rect_t *rect,
float *view_scale)
{
ClutterStagePrivate *priv = stage->priv;
@ -4887,12 +4887,12 @@ _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
{
ClutterStageView *view = l->data;
cairo_rectangle_int_t view_layout;
ClutterRect view_rect;
graphene_rect_t view_rect;
clutter_stage_view_get_layout (view, &view_layout);
_clutter_util_rect_from_rectangle (&view_layout, &view_rect);
if (clutter_rect_intersection (&view_rect, rect, NULL))
if (graphene_rect_intersection (&view_rect, rect, NULL))
scale = MAX (clutter_stage_view_get_scale (view), scale);
}

View File

@ -157,7 +157,7 @@ struct _ClutterTextPrivate
gint text_logical_y;
/* Where to draw the cursor */
ClutterRect cursor_rect;
graphene_rect_t cursor_rect;
ClutterColor cursor_color;
guint cursor_size;
@ -1304,7 +1304,7 @@ static inline void
update_cursor_location (ClutterText *self)
{
ClutterTextPrivate *priv = self->priv;
ClutterRect rect;
graphene_rect_t rect;
float x, y;
if (!priv->editable)
@ -1312,7 +1312,7 @@ update_cursor_location (ClutterText *self)
rect = priv->cursor_rect;
clutter_actor_get_transformed_position (CLUTTER_ACTOR (self), &x, &y);
clutter_rect_offset (&rect, x, y);
graphene_rect_offset (&rect, x, y);
clutter_input_focus_set_cursor_location (priv->input_focus, &rect);
}
@ -1322,7 +1322,7 @@ clutter_text_ensure_cursor_position (ClutterText *self,
{
ClutterTextPrivate *priv = self->priv;
gfloat x, y, cursor_height;
ClutterRect cursor_rect = CLUTTER_RECT_INIT_ZERO;
graphene_rect_t cursor_rect = GRAPHENE_RECT_INIT (0, 0, 0, 0);
gint position;
position = priv->position;
@ -1345,23 +1345,23 @@ clutter_text_ensure_cursor_position (ClutterText *self,
&x, &y,
&cursor_height);
clutter_rect_init (&cursor_rect,
graphene_rect_init (&cursor_rect,
x,
y + CURSOR_Y_PADDING * scale,
priv->cursor_size * scale,
cursor_height - 2 * CURSOR_Y_PADDING * scale);
if (!clutter_rect_equals (&priv->cursor_rect, &cursor_rect))
if (!graphene_rect_equal (&priv->cursor_rect, &cursor_rect))
{
ClutterGeometry cursor_pos;
priv->cursor_rect = cursor_rect;
/* XXX:2.0 - remove */
cursor_pos.x = clutter_rect_get_x (&priv->cursor_rect);
cursor_pos.y = clutter_rect_get_y (&priv->cursor_rect);
cursor_pos.width = clutter_rect_get_width (&priv->cursor_rect);
cursor_pos.height = clutter_rect_get_height (&priv->cursor_rect);
cursor_pos.x = graphene_rect_get_x (&priv->cursor_rect);
cursor_pos.y = graphene_rect_get_y (&priv->cursor_rect);
cursor_pos.width = graphene_rect_get_width (&priv->cursor_rect);
cursor_pos.height = graphene_rect_get_height (&priv->cursor_rect);
g_signal_emit (self, text_signals[CURSOR_EVENT], 0, &cursor_pos);
g_signal_emit (self, text_signals[CURSOR_CHANGED], 0);
@ -2700,7 +2700,7 @@ clutter_text_paint (ClutterActor *self)
if (actor_width < text_width)
{
gint cursor_x = clutter_rect_get_x (&priv->cursor_rect);
gint cursor_x = graphene_rect_get_x (&priv->cursor_rect);
if (priv->position == -1)
{
@ -6773,7 +6773,7 @@ clutter_text_get_layout_offsets (ClutterText *self,
*/
void
clutter_text_get_cursor_rect (ClutterText *self,
ClutterRect *rect)
graphene_rect_t *rect)
{
g_return_if_fail (CLUTTER_IS_TEXT (self));
g_return_if_fail (rect != NULL);

View File

@ -230,7 +230,7 @@ CLUTTER_EXPORT
guint clutter_text_get_cursor_size (ClutterText *self);
CLUTTER_EXPORT
void clutter_text_get_cursor_rect (ClutterText *self,
ClutterRect *rect);
graphene_rect_t *rect);
CLUTTER_EXPORT
void clutter_text_set_selectable (ClutterText *self,
gboolean selectable);

View File

@ -44,7 +44,6 @@ G_BEGIN_DECLS
#define CLUTTER_TYPE_MATRIX (clutter_matrix_get_type ())
#define CLUTTER_TYPE_PAINT_VOLUME (clutter_paint_volume_get_type ())
#define CLUTTER_TYPE_PERSPECTIVE (clutter_perspective_get_type ())
#define CLUTTER_TYPE_RECT (clutter_rect_get_type ())
typedef struct _ClutterActor ClutterActor;
@ -81,7 +80,6 @@ typedef struct _ClutterGeometry ClutterGeometry; /* XXX:2.0 - re
typedef struct _ClutterKnot ClutterKnot;
typedef struct _ClutterMargin ClutterMargin;
typedef struct _ClutterPerspective ClutterPerspective;
typedef struct _ClutterRect ClutterRect;
typedef struct _ClutterAlpha ClutterAlpha;
typedef struct _ClutterAnimation ClutterAnimation;
@ -131,123 +129,6 @@ typedef struct _ClutterShader ClutterShader; /* deprecated */
*/
typedef struct _ClutterPaintVolume ClutterPaintVolume;
/**
* ClutterRect:
* @origin: the origin of the rectangle
* @size: the size of the rectangle
*
* The location and size of a rectangle.
*
* The width and height of a #ClutterRect can be negative; Clutter considers
* a rectangle with an origin of [ 0.0, 0.0 ] and a size of [ 10.0, 10.0 ] to
* be equivalent to a rectangle with origin of [ 10.0, 10.0 ] and size of
* [ -10.0, -10.0 ].
*
* Application code can normalize rectangles using clutter_rect_normalize():
* this function will ensure that the width and height of a #ClutterRect are
* positive values. All functions taking a #ClutterRect as an argument will
* implicitly normalize it before computing eventual results. For this reason
* it is safer to access the contents of a #ClutterRect by using the provided
* API at all times, instead of directly accessing the structure members.
*
* Since: 1.12
*/
struct _ClutterRect
{
graphene_point_t origin;
graphene_size_t size;
};
/**
* CLUTTER_RECT_INIT:
* @x: the X coordinate
* @y: the Y coordinate
* @width: the width
* @height: the height
*
* A simple macro for initializing a #ClutterRect when declaring it, e.g.:
*
* |[
* ClutterRect r = CLUTTER_RECT_INIT (100, 100, 200, 200);
* ]|
*
* Since: 1.12
*/
#define CLUTTER_RECT_INIT(x,y,width,height) { { (x), (y) }, { (width), (height) } }
/**
* CLUTTER_RECT_INIT_ZERO:
*
* A simple macro for initializing a #ClutterRect to (0, 0, 0, 0) when
* declaring it.
*
* Since: 1.12
*/
#define CLUTTER_RECT_INIT_ZERO CLUTTER_RECT_INIT (0.f, 0.f, 0.f, 0.f)
CLUTTER_EXPORT
GType clutter_rect_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
const ClutterRect * clutter_rect_zero (void);
CLUTTER_EXPORT
ClutterRect * clutter_rect_alloc (void);
CLUTTER_EXPORT
ClutterRect * clutter_rect_init (ClutterRect *rect,
float x,
float y,
float width,
float height);
CLUTTER_EXPORT
ClutterRect * clutter_rect_copy (const ClutterRect *rect);
CLUTTER_EXPORT
void clutter_rect_free (ClutterRect *rect);
CLUTTER_EXPORT
gboolean clutter_rect_equals (ClutterRect *a,
ClutterRect *b);
CLUTTER_EXPORT
ClutterRect * clutter_rect_normalize (ClutterRect *rect);
CLUTTER_EXPORT
void clutter_rect_get_center (ClutterRect *rect,
graphene_point_t *center);
CLUTTER_EXPORT
gboolean clutter_rect_contains_point (ClutterRect *rect,
graphene_point_t *point);
CLUTTER_EXPORT
gboolean clutter_rect_contains_rect (ClutterRect *a,
ClutterRect *b);
CLUTTER_EXPORT
void clutter_rect_union (ClutterRect *a,
ClutterRect *b,
ClutterRect *res);
CLUTTER_EXPORT
gboolean clutter_rect_intersection (ClutterRect *a,
ClutterRect *b,
ClutterRect *res);
CLUTTER_EXPORT
void clutter_rect_offset (ClutterRect *rect,
float d_x,
float d_y);
CLUTTER_EXPORT
void clutter_rect_inset (ClutterRect *rect,
float d_x,
float d_y);
CLUTTER_EXPORT
void clutter_rect_scale (ClutterRect *rect,
float s_x,
float s_y);
CLUTTER_EXPORT
void clutter_rect_clamp_to_pixel (ClutterRect *rect);
CLUTTER_EXPORT
float clutter_rect_get_x (ClutterRect *rect);
CLUTTER_EXPORT
float clutter_rect_get_y (ClutterRect *rect);
CLUTTER_EXPORT
float clutter_rect_get_width (ClutterRect *rect);
CLUTTER_EXPORT
float clutter_rect_get_height (ClutterRect *rect);
/**
* ClutterActorBox:
* @x1: X coordinate of the top left corner
@ -388,7 +269,7 @@ void clutter_actor_box_scale (ClutterActorBox *box,
* The rectangle containing an actor's bounding box, measured in pixels.
*
* You should not use #ClutterGeometry, or operate on its fields
* directly; you should use #cairo_rectangle_int_t or #ClutterRect if you
* directly; you should use #cairo_rectangle_int_t or #graphene_rect_t if you
* need a rectangle type, depending on the precision required.
*
* Deprecated: 1.16

View File

@ -106,9 +106,9 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
}
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
ClutterRect *dest)
graphene_rect_t *dest)
{
*dest = (ClutterRect) {
*dest = (graphene_rect_t) {
.origin = {
.x = src->x,
.y = src->y
@ -120,12 +120,12 @@ void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
};
}
void _clutter_util_rectangle_int_extents (const ClutterRect *src,
void _clutter_util_rectangle_int_extents (const graphene_rect_t *src,
cairo_rectangle_int_t *dest)
{
ClutterRect tmp = *src;
graphene_rect_t tmp = *src;
clutter_rect_clamp_to_pixel (&tmp);
graphene_rect_round (&tmp, &tmp);
*dest = (cairo_rectangle_int_t) {
.x = tmp.origin.x,

View File

@ -576,14 +576,14 @@ is_buffer_age_enabled (void)
}
static void
scale_and_clamp_rect (const ClutterRect *rect,
scale_and_clamp_rect (const graphene_rect_t *rect,
float scale,
cairo_rectangle_int_t *dest)
{
ClutterRect tmp = *rect;
graphene_rect_t tmp = *rect;
clutter_rect_scale (&tmp, scale, scale);
graphene_rect_scale (&tmp, scale, scale, &tmp);
_clutter_util_rectangle_int_extents (&tmp, dest);
}
@ -650,12 +650,12 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
* frames when starting up... */
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3)
{
ClutterRect rect;
graphene_rect_t rect;
may_use_clipped_redraw = TRUE;
_clutter_util_rect_from_rectangle (&redraw_clip, &rect);
clutter_rect_offset (&rect, -view_rect.x, -view_rect.y);
graphene_rect_offset (&rect, -view_rect.x, -view_rect.y);
scale_and_clamp_rect (&rect, fb_scale, &fb_clip_region);
if (fb_scale != floorf (fb_scale))
@ -693,7 +693,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
if (valid_buffer_age (view_cogl, age))
{
ClutterRect rect;
graphene_rect_t rect;
cairo_rectangle_int_t damage_region;
*current_fb_damage = fb_clip_region;
@ -753,7 +753,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
}
else if (use_clipped_redraw)
{
ClutterRect rect;
graphene_rect_t rect;
cairo_rectangle_int_t scissor_rect;
cairo_rectangle_int_t paint_rect;
@ -799,7 +799,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
may_use_clipped_redraw &&
!clip_region_empty)
{
ClutterRect rect;
graphene_rect_t rect;
cairo_rectangle_int_t scissor_rect;
cairo_rectangle_int_t paint_rect;

View File

@ -90,7 +90,7 @@ queue_redraw (MetaCursorRenderer *renderer,
MetaBackend *backend = meta_get_backend ();
ClutterActor *stage = meta_backend_get_stage (backend);
CoglTexture *texture;
ClutterRect rect = CLUTTER_RECT_INIT_ZERO;
graphene_rect_t rect = GRAPHENE_RECT_INIT (0, 0, 0, 0);
if (cursor_sprite)
rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
@ -180,7 +180,7 @@ meta_cursor_renderer_init (MetaCursorRenderer *renderer)
NULL);
}
ClutterRect
graphene_rect_t
meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
@ -193,14 +193,14 @@ meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
texture = meta_cursor_sprite_get_cogl_texture (cursor_sprite);
if (!texture)
return (ClutterRect) CLUTTER_RECT_INIT_ZERO;
return (graphene_rect_t) GRAPHENE_RECT_INIT (0, 0, 0, 0);
meta_cursor_sprite_get_hotspot (cursor_sprite, &hot_x, &hot_y);
texture_scale = meta_cursor_sprite_get_texture_scale (cursor_sprite);
width = cogl_texture_get_width (texture);
height = cogl_texture_get_height (texture);
return (ClutterRect) {
return (graphene_rect_t) {
.origin = {
.x = priv->current_x - (hot_x * texture_scale),
.y = priv->current_y - (hot_y * texture_scale)

View File

@ -76,7 +76,7 @@ void meta_cursor_renderer_remove_hw_cursor_inhibitor (MetaCursorRenderer *ren
gboolean meta_cursor_renderer_is_hw_cursors_inhibited (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite);
ClutterRect meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
graphene_rect_t meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite);
void meta_cursor_renderer_emit_painted (MetaCursorRenderer *renderer,

View File

@ -142,23 +142,23 @@ is_cursor_in_stream (MetaScreenCastMonitorStreamSrc *monitor_src)
MetaMonitor *monitor;
MetaLogicalMonitor *logical_monitor;
MetaRectangle logical_monitor_layout;
ClutterRect logical_monitor_rect;
graphene_rect_t logical_monitor_rect;
MetaCursorSprite *cursor_sprite;
monitor = get_monitor (monitor_src);
logical_monitor = meta_monitor_get_logical_monitor (monitor);
logical_monitor_layout = meta_logical_monitor_get_layout (logical_monitor);
logical_monitor_rect =
meta_rectangle_to_clutter_rect (&logical_monitor_layout);
meta_rectangle_to_graphene_rect (&logical_monitor_layout);
cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer);
if (cursor_sprite)
{
ClutterRect cursor_rect;
graphene_rect_t cursor_rect;
cursor_rect = meta_cursor_renderer_calculate_rect (cursor_renderer,
cursor_sprite);
return clutter_rect_intersection (&cursor_rect,
return graphene_rect_intersection (&cursor_rect,
&logical_monitor_rect,
NULL);
}
@ -167,7 +167,7 @@ is_cursor_in_stream (MetaScreenCastMonitorStreamSrc *monitor_src)
graphene_point_t cursor_position;
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
return clutter_rect_contains_point (&logical_monitor_rect,
return graphene_rect_contains_point (&logical_monitor_rect,
&cursor_position);
}
}
@ -358,7 +358,7 @@ meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
MetaMonitor *monitor;
MetaLogicalMonitor *logical_monitor;
MetaRectangle logical_monitor_layout;
ClutterRect logical_monitor_rect;
graphene_rect_t logical_monitor_rect;
MetaRendererView *view;
float view_scale;
graphene_point_t cursor_position;
@ -377,7 +377,7 @@ meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
logical_monitor = meta_monitor_get_logical_monitor (monitor);
logical_monitor_layout = meta_logical_monitor_get_layout (logical_monitor);
logical_monitor_rect =
meta_rectangle_to_clutter_rect (&logical_monitor_layout);
meta_rectangle_to_graphene_rect (&logical_monitor_layout);
view = meta_renderer_get_view_from_logical_monitor (renderer,
logical_monitor);

View File

@ -37,7 +37,7 @@ void meta_stage_remove_cursor_overlay (MetaStage *stage,
void meta_stage_update_cursor_overlay (MetaStage *stage,
MetaOverlay *overlay,
CoglTexture *texture,
ClutterRect *rect);
graphene_rect_t *rect);
void meta_stage_set_active (MetaStage *stage,
gboolean is_active);

View File

@ -46,8 +46,8 @@ struct _MetaOverlay
CoglPipeline *pipeline;
CoglTexture *texture;
ClutterRect current_rect;
ClutterRect previous_rect;
graphene_rect_t current_rect;
graphene_rect_t previous_rect;
gboolean previous_is_valid;
};
@ -85,7 +85,7 @@ meta_overlay_free (MetaOverlay *overlay)
static void
meta_overlay_set (MetaOverlay *overlay,
CoglTexture *texture,
ClutterRect *rect)
graphene_rect_t *rect)
{
if (overlay->texture != texture)
{
@ -123,7 +123,7 @@ meta_overlay_paint (MetaOverlay *overlay)
(overlay->current_rect.origin.y +
overlay->current_rect.size.height));
if (!clutter_rect_equals (&overlay->previous_rect, &overlay->current_rect))
if (!graphene_rect_equal (&overlay->previous_rect, &overlay->current_rect))
{
overlay->previous_rect = overlay->current_rect;
overlay->previous_is_valid = TRUE;
@ -219,7 +219,7 @@ meta_stage_new (void)
static void
queue_redraw_clutter_rect (MetaStage *stage,
MetaOverlay *overlay,
ClutterRect *rect)
graphene_rect_t *rect)
{
cairo_rectangle_int_t clip = {
.x = floorf (rect->origin.x),
@ -281,7 +281,7 @@ void
meta_stage_update_cursor_overlay (MetaStage *stage,
MetaOverlay *overlay,
CoglTexture *texture,
ClutterRect *rect)
graphene_rect_t *rect)
{
g_assert (meta_is_wayland_compositor () || texture == NULL);

View File

@ -286,7 +286,7 @@ typedef struct
{
MetaCursorRendererNative *in_cursor_renderer_native;
MetaLogicalMonitor *in_logical_monitor;
ClutterRect in_local_cursor_rect;
graphene_rect_t in_local_cursor_rect;
MetaCursorSprite *in_cursor_sprite;
gboolean out_painted;
@ -306,7 +306,7 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
meta_cursor_renderer_native_get_instance_private (cursor_renderer_native);
MetaCrtc *crtc;
MetaMonitorTransform transform;
ClutterRect scaled_crtc_rect;
graphene_rect_t scaled_crtc_rect;
float scale;
int crtc_x, crtc_y;
int crtc_width, crtc_height;
@ -333,7 +333,7 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
crtc_height = monitor_crtc_mode->crtc_mode->height;
}
scaled_crtc_rect = (ClutterRect) {
scaled_crtc_rect = (graphene_rect_t) {
.origin = {
.x = crtc_x / scale,
.y = crtc_y / scale
@ -347,7 +347,7 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
crtc = meta_output_get_assigned_crtc (monitor_crtc_mode->output);
if (priv->has_hw_cursor &&
clutter_rect_intersection (&scaled_crtc_rect,
graphene_rect_intersection (&scaled_crtc_rect,
&data->in_local_cursor_rect,
NULL))
{
@ -390,13 +390,13 @@ update_hw_cursor (MetaCursorRendererNative *native,
MetaMonitorManager *monitor_manager = priv->monitor_manager;
GList *logical_monitors;
GList *l;
ClutterRect rect;
graphene_rect_t rect;
gboolean painted = FALSE;
if (cursor_sprite)
rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
else
rect = (ClutterRect) { 0 };
rect = GRAPHENE_RECT_INIT (0, 0, 0, 0);
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager);
@ -410,7 +410,7 @@ update_hw_cursor (MetaCursorRendererNative *native,
data = (UpdateCrtcCursorData) {
.in_cursor_renderer_native = native,
.in_logical_monitor = logical_monitor,
.in_local_cursor_rect = (ClutterRect) {
.in_local_cursor_rect = (graphene_rect_t) {
.origin = {
.x = rect.origin.x - logical_monitor->rect.x,
.y = rect.origin.y - logical_monitor->rect.y
@ -483,7 +483,7 @@ cursor_over_transformed_logical_monitor (MetaCursorRenderer *renderer,
MetaMonitorManager *monitor_manager = priv->monitor_manager;
GList *logical_monitors;
GList *l;
ClutterRect cursor_rect;
graphene_rect_t cursor_rect;
cursor_rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
@ -493,16 +493,16 @@ cursor_over_transformed_logical_monitor (MetaCursorRenderer *renderer,
{
MetaLogicalMonitor *logical_monitor = l->data;
MetaRectangle logical_monitor_layout;
ClutterRect logical_monitor_rect;
graphene_rect_t logical_monitor_rect;
MetaMonitorTransform transform;
GList *monitors, *l_mon;
logical_monitor_layout =
meta_logical_monitor_get_layout (logical_monitor);
logical_monitor_rect =
meta_rectangle_to_clutter_rect (&logical_monitor_layout);
meta_rectangle_to_graphene_rect (&logical_monitor_layout);
if (!clutter_rect_intersection (&cursor_rect, &logical_monitor_rect,
if (!graphene_rect_intersection (&cursor_rect, &logical_monitor_rect,
NULL))
continue;
@ -539,7 +539,7 @@ can_draw_cursor_unscaled (MetaCursorRenderer *renderer,
MetaCursorRendererNativePrivate *priv =
meta_cursor_renderer_native_get_instance_private (cursor_renderer_native);
MetaMonitorManager *monitor_manager = priv->monitor_manager;
ClutterRect cursor_rect;
graphene_rect_t cursor_rect;
GList *logical_monitors;
GList *l;
gboolean has_visible_crtc_sprite = FALSE;
@ -558,10 +558,10 @@ can_draw_cursor_unscaled (MetaCursorRenderer *renderer,
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
ClutterRect logical_monitor_rect =
meta_rectangle_to_clutter_rect (&logical_monitor->rect);
graphene_rect_t logical_monitor_rect =
meta_rectangle_to_graphene_rect (&logical_monitor->rect);
if (!clutter_rect_intersection (&cursor_rect,
if (!graphene_rect_intersection (&cursor_rect,
&logical_monitor_rect,
NULL))
continue;
@ -684,7 +684,7 @@ calculate_cursor_sprite_gpus (MetaCursorRenderer *renderer,
GList *gpus = NULL;
GList *logical_monitors;
GList *l;
ClutterRect cursor_rect;
graphene_rect_t cursor_rect;
cursor_rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
@ -694,15 +694,15 @@ calculate_cursor_sprite_gpus (MetaCursorRenderer *renderer,
{
MetaLogicalMonitor *logical_monitor = l->data;
MetaRectangle logical_monitor_layout;
ClutterRect logical_monitor_rect;
graphene_rect_t logical_monitor_rect;
GList *monitors, *l_mon;
logical_monitor_layout =
meta_logical_monitor_get_layout (logical_monitor);
logical_monitor_rect =
meta_rectangle_to_clutter_rect (&logical_monitor_layout);
meta_rectangle_to_graphene_rect (&logical_monitor_layout);
if (!clutter_rect_intersection (&cursor_rect, &logical_monitor_rect,
if (!graphene_rect_intersection (&cursor_rect, &logical_monitor_rect,
NULL))
continue;

View File

@ -45,7 +45,7 @@ cairo_region_t * meta_shaped_texture_get_opaque_region (MetaShapedTexture *stex)
void meta_shaped_texture_set_transform (MetaShapedTexture *stex,
MetaMonitorTransform transform);
void meta_shaped_texture_set_viewport_src_rect (MetaShapedTexture *stex,
ClutterRect *src_rect);
graphene_rect_t *src_rect);
void meta_shaped_texture_reset_viewport_src_rect (MetaShapedTexture *stex);
void meta_shaped_texture_set_viewport_dst_size (MetaShapedTexture *stex,
int dst_width,

View File

@ -109,7 +109,7 @@ struct _MetaShapedTexture
gboolean size_invalid;
MetaMonitorTransform transform;
gboolean has_viewport_src_rect;
ClutterRect viewport_src_rect;
graphene_rect_t viewport_src_rect;
gboolean has_viewport_dst_size;
int viewport_dst_width;
int viewport_dst_height;
@ -997,8 +997,8 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
if (stex->has_viewport_src_rect || stex->has_viewport_dst_size)
{
ClutterRect viewport;
ClutterRect inverted_viewport;
graphene_rect_t viewport;
graphene_rect_t inverted_viewport;
double tex_scale;
float dst_width;
float dst_height;
@ -1013,7 +1013,7 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
}
else
{
viewport = (ClutterRect) {
viewport = (graphene_rect_t) {
.origin.x = 0,
.origin.y = 0,
.size.width = stex->tex_width * tex_scale,
@ -1032,7 +1032,7 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
dst_height = (float) stex->tex_height * tex_scale;
}
inverted_viewport = (ClutterRect) {
inverted_viewport = (graphene_rect_t) {
.origin.x = -((viewport.origin.x * (dst_width / viewport.size.width)) / tex_scale),
.origin.y = -((viewport.origin.y * (dst_height / viewport.size.height)) / tex_scale),
.size.width = dst_width,
@ -1204,7 +1204,7 @@ meta_shaped_texture_set_transform (MetaShapedTexture *stex,
void
meta_shaped_texture_set_viewport_src_rect (MetaShapedTexture *stex,
ClutterRect *src_rect)
graphene_rect_t *src_rect)
{
if (!stex->has_viewport_src_rect ||
stex->viewport_src_rect.origin.x != src_rect->origin.x ||

View File

@ -423,7 +423,7 @@ meta_surface_actor_set_transform (MetaSurfaceActor *self,
void
meta_surface_actor_set_viewport_src_rect (MetaSurfaceActor *self,
ClutterRect *src_rect)
graphene_rect_t *src_rect)
{
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);

View File

@ -66,7 +66,7 @@ gboolean meta_surface_actor_is_unredirected (MetaSurfaceActor *actor);
void meta_surface_actor_set_transform (MetaSurfaceActor *self,
MetaMonitorTransform transform);
void meta_surface_actor_set_viewport_src_rect (MetaSurfaceActor *self,
ClutterRect *src_rect);
graphene_rect_t *src_rect);
void meta_surface_actor_reset_viewport_src_rect (MetaSurfaceActor *self);
void meta_surface_actor_set_viewport_dst_size (MetaSurfaceActor *self,
int dst_width,

View File

@ -411,7 +411,7 @@ meta_region_transform (cairo_region_t *region,
cairo_region_t *
meta_region_crop_and_scale (cairo_region_t *region,
ClutterRect *src_rect,
graphene_rect_t *src_rect,
int dst_width,
int dst_height)
{

View File

@ -112,7 +112,7 @@ cairo_region_t * meta_region_transform (cairo_region_t *region,
int height);
cairo_region_t * meta_region_crop_and_scale (cairo_region_t *region,
ClutterRect *src_rect,
graphene_rect_t *src_rect,
int dst_width,
int dst_height);

View File

@ -252,10 +252,10 @@ void meta_rectangle_scale_double (const MetaRectangle *rect,
MetaRoundingStrategy rounding_strategy,
MetaRectangle *dest);
static inline ClutterRect
meta_rectangle_to_clutter_rect (MetaRectangle *rect)
static inline graphene_rect_t
meta_rectangle_to_graphene_rect (MetaRectangle *rect)
{
return (ClutterRect) {
return (graphene_rect_t) {
.origin = {
.x = rect->x,
.y = rect->y
@ -274,12 +274,12 @@ void meta_rectangle_transform (const MetaRectangle *rect,
int height,
MetaRectangle *dest);
void meta_rectangle_from_clutter_rect (ClutterRect *rect,
void meta_rectangle_from_graphene_rect (const graphene_rect_t *rect,
MetaRoundingStrategy rounding_strategy,
MetaRectangle *dest);
void meta_rectangle_crop_and_scale (const MetaRectangle *rect,
ClutterRect *src_rect,
graphene_rect_t *src_rect,
int dst_width,
int dst_height,
MetaRectangle *dest);

View File

@ -2152,7 +2152,7 @@ meta_rectangle_transform (const MetaRectangle *rect,
}
void
meta_rectangle_from_clutter_rect (ClutterRect *rect,
meta_rectangle_from_graphene_rect (const graphene_rect_t *rect,
MetaRoundingStrategy rounding_strategy,
MetaRectangle *dest)
{
@ -2170,8 +2170,9 @@ meta_rectangle_from_clutter_rect (ClutterRect *rect,
break;
case META_ROUNDING_STRATEGY_GROW:
{
ClutterRect clamped = *rect;
clutter_rect_clamp_to_pixel (&clamped);
graphene_rect_t clamped = *rect;
graphene_rect_round (&clamped, &clamped);
*dest = (MetaRectangle) {
.x = clamped.origin.x,
@ -2186,18 +2187,19 @@ meta_rectangle_from_clutter_rect (ClutterRect *rect,
void
meta_rectangle_crop_and_scale (const MetaRectangle *rect,
ClutterRect *src_rect,
graphene_rect_t *src_rect,
int dst_width,
int dst_height,
MetaRectangle *dest)
{
ClutterRect tmp = CLUTTER_RECT_INIT (rect->x, rect->y,
graphene_rect_t tmp = GRAPHENE_RECT_INIT (rect->x, rect->y,
rect->width, rect->height);
clutter_rect_scale (&tmp,
graphene_rect_scale (&tmp,
src_rect->size.width / dst_width,
src_rect->size.height / dst_height);
clutter_rect_offset (&tmp, src_rect->origin.x, src_rect->origin.y);
src_rect->size.height / dst_height,
&tmp);
graphene_rect_offset (&tmp, src_rect->origin.x, src_rect->origin.y);
meta_rectangle_from_clutter_rect (&tmp, META_ROUNDING_STRATEGY_GROW, dest);
meta_rectangle_from_graphene_rect (&tmp, META_ROUNDING_STRATEGY_GROW, dest);
}

View File

@ -1452,7 +1452,7 @@ find_highest_logical_monitor_scale (MetaBackend *backend,
meta_backend_get_monitor_manager (backend);
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
ClutterRect cursor_rect;
graphene_rect_t cursor_rect;
GList *logical_monitors;
GList *l;
float highest_scale = 0.0;
@ -1465,10 +1465,10 @@ find_highest_logical_monitor_scale (MetaBackend *backend,
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
ClutterRect logical_monitor_rect =
meta_rectangle_to_clutter_rect (&logical_monitor->rect);
graphene_rect_t logical_monitor_rect =
meta_rectangle_to_graphene_rect (&logical_monitor->rect);
if (!clutter_rect_intersection (&cursor_rect,
if (!graphene_rect_intersection (&cursor_rect,
&logical_monitor_rect,
NULL))
continue;

View File

@ -186,14 +186,14 @@ meta_wayland_cursor_surface_is_on_logical_monitor (MetaWaylandSurfaceRole *role,
MetaWaylandCursorSurfacePrivate *priv =
meta_wayland_cursor_surface_get_instance_private (cursor_surface);
graphene_point_t point;
ClutterRect logical_monitor_rect;
graphene_rect_t logical_monitor_rect;
logical_monitor_rect =
meta_rectangle_to_clutter_rect (&logical_monitor->rect);
meta_rectangle_to_graphene_rect (&logical_monitor->rect);
point = meta_cursor_renderer_get_position (priv->cursor_renderer);
return clutter_rect_contains_point (&logical_monitor_rect, &point);
return graphene_rect_contains_point (&logical_monitor_rect, &point);
}
static void

View File

@ -274,7 +274,7 @@ surface_process_damage (MetaWaylandSurface *surface,
cairo_region_t *scaled_region;
cairo_region_t *transformed_region;
cairo_region_t *viewport_region;
ClutterRect src_rect;
graphene_rect_t src_rect;
MetaSurfaceActor *actor;
/* If the client destroyed the buffer it attached before committing, but
@ -303,7 +303,7 @@ surface_process_damage (MetaWaylandSurface *surface,
scaled_region = meta_region_scale (surface_region, surface->scale);
if (surface->viewport.has_src_rect)
{
src_rect = (ClutterRect) {
src_rect = (graphene_rect_t) {
.origin.x = surface->viewport.src_rect.origin.x * surface->scale,
.origin.y = surface->viewport.src_rect.origin.y * surface->scale,
.size.width = surface->viewport.src_rect.size.width * surface->scale,
@ -312,7 +312,7 @@ surface_process_damage (MetaWaylandSurface *surface,
}
else
{
src_rect = (ClutterRect) {
src_rect = (graphene_rect_t) {
.size.width = surface_rect.width * surface->scale,
.size.height = surface_rect.height * surface->scale,
};

View File

@ -110,7 +110,7 @@ struct _MetaWaylandPendingState
gboolean has_new_buffer_transform;
MetaMonitorTransform buffer_transform;
gboolean has_new_viewport_src_rect;
ClutterRect viewport_src_rect;
graphene_rect_t viewport_src_rect;
gboolean has_new_viewport_dst_size;
int viewport_dst_width;
int viewport_dst_height;
@ -211,7 +211,7 @@ struct _MetaWaylandSurface
gulong destroy_handler_id;
gboolean has_src_rect;
ClutterRect src_rect;
graphene_rect_t src_rect;
gboolean has_dst_size;
int dst_width;

View File

@ -475,7 +475,7 @@ text_input_commit_state (struct wl_client *client,
if (text_input->pending_state & META_WAYLAND_PENDING_STATE_INPUT_RECT)
{
ClutterRect cursor_rect;
graphene_rect_t cursor_rect;
float x1, y1, x2, y2;
cairo_rectangle_int_t rect;
@ -487,7 +487,7 @@ text_input_commit_state (struct wl_client *client,
rect.y + rect.height,
&x2, &y2);
clutter_rect_init (&cursor_rect, x1, y1, x2 - x1, y2 - y1);
graphene_rect_init (&cursor_rect, x1, y1, x2 - x1, y2 - y1);
clutter_input_focus_set_cursor_location (text_input->input_focus,
&cursor_rect);
}

View File

@ -525,7 +525,7 @@ text_input_commit_state (struct wl_client *client,
if (text_input->pending_state & META_WAYLAND_PENDING_STATE_INPUT_RECT)
{
ClutterRect cursor_rect;
graphene_rect_t cursor_rect;
float x1, y1, x2, y2;
cairo_rectangle_int_t rect;
@ -537,7 +537,7 @@ text_input_commit_state (struct wl_client *client,
rect.y + rect.height,
&x2, &y2);
clutter_rect_init (&cursor_rect, x1, y1, x2 - x1, y2 - y1);
graphene_rect_init (&cursor_rect, x1, y1, x2 - x1, y2 - y1);
clutter_input_focus_set_cursor_location (text_input->input_focus,
&cursor_rect);
}