2.0: Remove ClutterGeometry

This commit is contained in:
Emmanuele Bassi
2013-03-30 00:24:17 +00:00
parent 0724b3fb91
commit 0b03a4cb0a
6 changed files with 38 additions and 192 deletions

View File

@ -43,114 +43,6 @@
/*
* ClutterGeometry
*/
static ClutterGeometry*
clutter_geometry_copy (const ClutterGeometry *geometry)
{
return g_slice_dup (ClutterGeometry, geometry);
}
static void
clutter_geometry_free (ClutterGeometry *geometry)
{
if (G_LIKELY (geometry != NULL))
g_slice_free (ClutterGeometry, geometry);
}
/**
* clutter_geometry_union:
* @geometry_a: a #ClutterGeometry
* @geometry_b: another #ClutterGeometry
* @result: (out): location to store the result
*
* Find the union of two rectangles represented as #ClutterGeometry.
*
* Since: 1.4
*
* Deprecated: 1.16: Use #ClutterRect and clutter_rect_union()
*/
void
clutter_geometry_union (const ClutterGeometry *geometry_a,
const ClutterGeometry *geometry_b,
ClutterGeometry *result)
{
/* We don't try to handle rectangles that can't be represented
* as a signed integer box */
gint x_1 = MIN (geometry_a->x, geometry_b->x);
gint y_1 = MIN (geometry_a->y, geometry_b->y);
gint x_2 = MAX (geometry_a->x + (gint)geometry_a->width,
geometry_b->x + (gint)geometry_b->width);
gint y_2 = MAX (geometry_a->y + (gint)geometry_a->height,
geometry_b->y + (gint)geometry_b->height);
result->x = x_1;
result->y = y_1;
result->width = x_2 - x_1;
result->height = y_2 - y_1;
}
/**
* clutter_geometry_intersects:
* @geometry0: The first geometry to test
* @geometry1: The second geometry to test
*
* Determines if @geometry0 and geometry1 intersect returning %TRUE if
* they do else %FALSE.
*
* Return value: %TRUE of @geometry0 and geometry1 intersect else
* %FALSE.
*
* Since: 1.4
*
* Deprecated: 1.16: Use #ClutterRect and clutter_rect_intersection()
*/
gboolean
clutter_geometry_intersects (const ClutterGeometry *geometry0,
const ClutterGeometry *geometry1)
{
if (geometry1->x >= (geometry0->x + (gint)geometry0->width) ||
geometry1->y >= (geometry0->y + (gint)geometry0->height) ||
(geometry1->x + (gint)geometry1->width) <= geometry0->x ||
(geometry1->y + (gint)geometry1->height) <= geometry0->y)
return FALSE;
else
return TRUE;
}
static gboolean
clutter_geometry_progress (const GValue *a,
const GValue *b,
gdouble progress,
GValue *retval)
{
const ClutterGeometry *a_geom = g_value_get_boxed (a);
const ClutterGeometry *b_geom = g_value_get_boxed (b);
ClutterGeometry res = { 0, };
gint a_width = a_geom->width;
gint b_width = b_geom->width;
gint a_height = a_geom->height;
gint b_height = b_geom->height;
res.x = a_geom->x + (b_geom->x - a_geom->x) * progress;
res.y = a_geom->y + (b_geom->y - a_geom->y) * progress;
res.width = a_width + (b_width - a_width) * progress;
res.height = a_height + (b_height - a_height) * progress;
g_value_set_boxed (retval, &res);
return TRUE;
}
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterGeometry, clutter_geometry,
clutter_geometry_copy,
clutter_geometry_free,
CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_geometry_progress));
/*
* ClutterVertices
*/