Replace ClutterVertex by graphene_point3d_t

Pretty direct and straightforward port. This requires
a GNOME Shell counterpart.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
This commit is contained in:
Georges Basile Stavracas Neto 2019-02-20 10:18:48 -03:00
parent c66221db76
commit 4dd3e00609
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385
26 changed files with 158 additions and 426 deletions

View File

@ -657,7 +657,7 @@ cally_actor_get_extents (AtkComponent *component,
ClutterActor *actor = NULL;
gint top_level_x, top_level_y;
gfloat f_width, f_height;
ClutterVertex verts[4];
graphene_point3d_t verts[4];
ClutterActor *stage = NULL;
g_return_if_fail (CALLY_IS_ACTOR (component));

View File

@ -1438,7 +1438,7 @@ static void cally_text_get_character_extents (AtkText *text,
PangoLayout *layout;
PangoRectangle extents;
const gchar *text_value;
ClutterVertex verts[4];
graphene_point3d_t verts[4];
actor = CALLY_GET_CLUTTER_ACTOR (text);
if (actor == NULL) /* State is defunct */
@ -2294,7 +2294,7 @@ _cally_misc_get_index_at_point (ClutterText *clutter_text,
gint index, x_window, y_window, x_toplevel, y_toplevel;
gint x_temp, y_temp;
gboolean ret;
ClutterVertex verts[4];
graphene_point3d_t verts[4];
PangoLayout *layout;
gint x_layout, y_layout;

View File

@ -340,7 +340,7 @@ clutter_actor_box_contains (const ClutterActorBox *box,
/**
* clutter_actor_box_from_vertices:
* @box: a #ClutterActorBox
* @verts: (array fixed-size=4): array of four #ClutterVertex
* @verts: (array fixed-size=4): array of four #graphene_point3d_t
*
* Calculates the bounding box represented by the four vertices; for details
* of the vertex array see clutter_actor_get_abs_allocation_vertices().
@ -349,7 +349,7 @@ clutter_actor_box_contains (const ClutterActorBox *box,
*/
void
clutter_actor_box_from_vertices (ClutterActorBox *box,
const ClutterVertex verts[])
const graphene_point3d_t verts[])
{
gfloat x_1, x_2, y_1, y_2;

View File

@ -135,7 +135,7 @@ struct _AnchorCoord
} fraction;
/* Use when is_fractional == FALSE */
ClutterVertex units;
graphene_point3d_t units;
} v;
};
@ -203,7 +203,7 @@ struct _ClutterTransformInfo
AnchorCoord anchor;
/* translation */
ClutterVertex translation;
graphene_point3d_t translation;
/* z_position */
gfloat z_position;

View File

@ -2825,8 +2825,8 @@ clutter_actor_real_queue_relayout (ClutterActor *self)
* @self: A #ClutterActor
* @ancestor: (allow-none): A #ClutterActor ancestor, or %NULL to use the
* default #ClutterStage
* @point: A point as #ClutterVertex
* @vertex: (out caller-allocates): The translated #ClutterVertex
* @point: A point as #graphene_point3d_t
* @vertex: (out caller-allocates): The translated #graphene_point3d_t
*
* Transforms @point in coordinates relative to the actor into
* ancestor-relative coordinates using the relevant transform
@ -2840,10 +2840,10 @@ clutter_actor_real_queue_relayout (ClutterActor *self)
* Since: 0.6
*/
void
clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
ClutterActor *ancestor,
const ClutterVertex *point,
ClutterVertex *vertex)
clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
ClutterActor *ancestor,
const graphene_point3d_t *point,
graphene_point3d_t *vertex)
{
gfloat w;
CoglMatrix matrix;
@ -2870,10 +2870,10 @@ clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
}
static gboolean
_clutter_actor_fully_transform_vertices (ClutterActor *self,
const ClutterVertex *vertices_in,
ClutterVertex *vertices_out,
int n_vertices)
_clutter_actor_fully_transform_vertices (ClutterActor *self,
const graphene_point3d_t *vertices_in,
graphene_point3d_t *vertices_out,
int n_vertices)
{
ClutterActor *stage;
CoglMatrix modelview;
@ -2915,8 +2915,8 @@ _clutter_actor_fully_transform_vertices (ClutterActor *self,
/**
* clutter_actor_apply_transform_to_point:
* @self: A #ClutterActor
* @point: A point as #ClutterVertex
* @vertex: (out caller-allocates): The translated #ClutterVertex
* @point: A point as #graphene_point3d_t
* @vertex: (out caller-allocates): The translated #graphene_point3d_t
*
* Transforms @point in coordinates relative to the actor
* into screen-relative coordinates with the current actor
@ -2925,9 +2925,9 @@ _clutter_actor_fully_transform_vertices (ClutterActor *self,
* Since: 0.4
**/
void
clutter_actor_apply_transform_to_point (ClutterActor *self,
const ClutterVertex *point,
ClutterVertex *vertex)
clutter_actor_apply_transform_to_point (ClutterActor *self,
const graphene_point3d_t *point,
graphene_point3d_t *vertex)
{
g_return_if_fail (point != NULL);
g_return_if_fail (vertex != NULL);
@ -2977,10 +2977,10 @@ _clutter_actor_get_relative_transformation_matrix (ClutterActor *self,
* transformed vertices to @verts[]. */
static gboolean
_clutter_actor_transform_and_project_box (ClutterActor *self,
const ClutterActorBox *box,
ClutterVertex verts[])
const ClutterActorBox *box,
graphene_point3d_t *verts)
{
ClutterVertex box_vertices[4];
graphene_point3d_t box_vertices[4];
box_vertices[0].x = box->x1;
box_vertices[0].y = box->y1;
@ -3004,8 +3004,8 @@ _clutter_actor_transform_and_project_box (ClutterActor *self,
* @self: A #ClutterActor
* @ancestor: (allow-none): A #ClutterActor to calculate the vertices
* against, or %NULL to use the #ClutterStage
* @verts: (out) (array fixed-size=4) (element-type Clutter.Vertex): return
* location for an array of 4 #ClutterVertex in which to store the result
* @verts: (out) (array fixed-size=4): return
* location for an array of 4 #graphene_point3d_t in which to store the result
*
* Calculates the transformed coordinates of the four corners of the
* actor in the plane of @ancestor. The returned vertices relate to
@ -3024,13 +3024,13 @@ _clutter_actor_transform_and_project_box (ClutterActor *self,
* Since: 0.6
*/
void
clutter_actor_get_allocation_vertices (ClutterActor *self,
ClutterActor *ancestor,
ClutterVertex verts[])
clutter_actor_get_allocation_vertices (ClutterActor *self,
ClutterActor *ancestor,
graphene_point3d_t *verts)
{
ClutterActorPrivate *priv;
ClutterActorBox box;
ClutterVertex vertices[4];
graphene_point3d_t vertices[4];
CoglMatrix modelview;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
@ -3082,9 +3082,9 @@ clutter_actor_get_allocation_vertices (ClutterActor *self,
cogl_matrix_transform_points (&modelview,
3,
sizeof (ClutterVertex),
sizeof (graphene_point3d_t),
vertices,
sizeof (ClutterVertex),
sizeof (graphene_point3d_t),
vertices,
4);
}
@ -3093,7 +3093,7 @@ clutter_actor_get_allocation_vertices (ClutterActor *self,
* clutter_actor_get_abs_allocation_vertices:
* @self: A #ClutterActor
* @verts: (out) (array fixed-size=4): Pointer to a location of an array
* of 4 #ClutterVertex where to store the result.
* of 4 #graphene_point3d_t where to store the result.
*
* Calculates the transformed screen coordinates of the four corners of
* the actor; the returned vertices relate to the #ClutterActorBox
@ -3107,8 +3107,8 @@ clutter_actor_get_allocation_vertices (ClutterActor *self,
* Since: 0.4
*/
void
clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
ClutterVertex verts[])
clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
graphene_point3d_t *verts)
{
ClutterActorPrivate *priv;
ClutterActorBox actor_space_allocation;
@ -3349,7 +3349,7 @@ _clutter_actor_draw_paint_volume_full (ClutterActor *self,
{
static CoglPipeline *outline = NULL;
CoglPrimitive *prim;
ClutterVertex line_ends[12 * 2];
graphene_point3d_t line_ends[12 * 2];
int n_vertices;
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
@ -4397,7 +4397,7 @@ static const ClutterTransformInfo default_transform_info = {
{ 0, }, /* anchor XXX:2.0 - remove*/
CLUTTER_VERTEX_INIT_ZERO, /* translation */
GRAPHENE_POINT3D_INIT_ZERO, /* translation */
0.f, /* z-position */
@ -4788,9 +4788,9 @@ clutter_actor_get_rotation_angle (ClutterActor *self,
static inline void
clutter_actor_set_rotation_center_internal (ClutterActor *self,
ClutterRotateAxis axis,
const ClutterVertex *center)
const graphene_point3d_t *center)
{
ClutterVertex v = CLUTTER_VERTEX_INIT_ZERO;
graphene_point3d_t v = GRAPHENE_POINT3D_INIT_ZERO;
GObject *obj = G_OBJECT (self);
ClutterTransformInfo *info;
@ -5705,7 +5705,7 @@ clutter_actor_get_property (GObject *object,
case PROP_ROTATION_CENTER_X: /* XXX:2.0 - remove */
{
ClutterVertex center;
graphene_point3d_t center;
clutter_actor_get_rotation (actor, CLUTTER_X_AXIS,
&center.x,
@ -5718,7 +5718,7 @@ clutter_actor_get_property (GObject *object,
case PROP_ROTATION_CENTER_Y: /* XXX:2.0 - remove */
{
ClutterVertex center;
graphene_point3d_t center;
clutter_actor_get_rotation (actor, CLUTTER_Y_AXIS,
&center.x,
@ -5731,7 +5731,7 @@ clutter_actor_get_property (GObject *object,
case PROP_ROTATION_CENTER_Z: /* XXX:2.0 - remove */
{
ClutterVertex center;
graphene_point3d_t center;
clutter_actor_get_rotation (actor, CLUTTER_Z_AXIS,
&center.x,
@ -6141,7 +6141,7 @@ clutter_actor_update_default_paint_volume (ClutterActor *self,
priv->clip.size.width >= 0 &&
priv->clip.size.height >= 0)
{
ClutterVertex origin;
graphene_point3d_t origin;
origin.x = priv->clip.origin.x;
origin.y = priv->clip.origin.y;
@ -7194,7 +7194,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_boxed ("rotation-center-x",
P_("Rotation Center X"),
P_("The rotation center on the X axis"),
CLUTTER_TYPE_VERTEX,
GRAPHENE_TYPE_POINT3D,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
G_PARAM_DEPRECATED);
@ -7212,7 +7212,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_boxed ("rotation-center-y",
P_("Rotation Center Y"),
P_("The rotation center on the Y axis"),
CLUTTER_TYPE_VERTEX,
GRAPHENE_TYPE_POINT3D,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
G_PARAM_DEPRECATED);
@ -7230,7 +7230,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_boxed ("rotation-center-z",
P_("Rotation Center Z"),
P_("The rotation center on the Z axis"),
CLUTTER_TYPE_VERTEX,
GRAPHENE_TYPE_POINT3D,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
G_PARAM_DEPRECATED);
@ -8857,7 +8857,7 @@ _clutter_actor_queue_redraw_full (ClutterActor *self,
if (flags & CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION)
{
ClutterActorBox allocation_clip;
ClutterVertex origin;
graphene_point3d_t origin;
/* If the actor doesn't have a valid allocation then we will
* queue a full stage redraw. */
@ -9061,7 +9061,7 @@ clutter_actor_queue_redraw_with_clip (ClutterActor *self,
const cairo_rectangle_int_t *clip)
{
ClutterPaintVolume volume;
ClutterVertex origin;
graphene_point3d_t origin;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
@ -10880,8 +10880,8 @@ clutter_actor_get_transformed_position (ClutterActor *self,
gfloat *x,
gfloat *y)
{
ClutterVertex v1;
ClutterVertex v2;
graphene_point3d_t v1;
graphene_point3d_t v2;
v1.x = v1.y = v1.z = 0;
clutter_actor_apply_transform_to_point (self, &v1, &v2);
@ -10927,7 +10927,7 @@ clutter_actor_get_transformed_size (ClutterActor *self,
gfloat *height)
{
ClutterActorPrivate *priv;
ClutterVertex v[4];
graphene_point3d_t v[4];
gfloat x_min, x_max, y_min, y_max;
gint i;
@ -12239,7 +12239,7 @@ clutter_actor_set_rotation (ClutterActor *self,
gfloat y,
gfloat z)
{
ClutterVertex v;
graphene_point3d_t v;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
@ -15186,7 +15186,7 @@ clutter_actor_transform_stage_point (ClutterActor *self,
gfloat *x_out,
gfloat *y_out)
{
ClutterVertex v[4];
graphene_point3d_t v[4];
double ST[3][3];
double RQ[3][3];
int du, dv;

View File

@ -431,7 +431,7 @@ void clutter_actor_get_allocation_box
CLUTTER_EXPORT
void clutter_actor_get_allocation_vertices (ClutterActor *self,
ClutterActor *ancestor,
ClutterVertex verts[]);
graphene_point3d_t *verts);
CLUTTER_EXPORT
gboolean clutter_actor_has_allocation (ClutterActor *self);
CLUTTER_EXPORT
@ -817,16 +817,16 @@ gboolean clutter_actor_transform_stage_point
gfloat *y_out);
CLUTTER_EXPORT
void clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
ClutterVertex verts[]);
graphene_point3d_t *verts);
CLUTTER_EXPORT
void clutter_actor_apply_transform_to_point (ClutterActor *self,
const ClutterVertex *point,
ClutterVertex *vertex);
const graphene_point3d_t *point,
graphene_point3d_t *vertex);
CLUTTER_EXPORT
void clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
ClutterActor *ancestor,
const ClutterVertex *point,
ClutterVertex *vertex);
const graphene_point3d_t *point,
graphene_point3d_t *vertex);
/* Implicit animations */
CLUTTER_EXPORT

View File

@ -97,7 +97,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPoint, clutter_point_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRect, clutter_rect_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSize, clutter_size_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterVertex, clutter_vertex_free)
#endif /* __GI_SCANNER__ */

View File

@ -149,178 +149,6 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterGeometry, clutter_geometry,
/*
* ClutterVertices
*/
/**
* clutter_vertex_new:
* @x: X coordinate
* @y: Y coordinate
* @z: Z coordinate
*
* Creates a new #ClutterVertex for the point in 3D space
* identified by the 3 coordinates @x, @y, @z.
*
* This function is the logical equivalent of:
*
* |[
* clutter_vertex_init (clutter_vertex_alloc (), x, y, z);
* ]|
*
* Return value: (transfer full): the newly allocated #ClutterVertex.
* Use clutter_vertex_free() to free the resources
*
* Since: 1.0
*/
ClutterVertex *
clutter_vertex_new (gfloat x,
gfloat y,
gfloat z)
{
return clutter_vertex_init (clutter_vertex_alloc (), x, y, z);
}
/**
* clutter_vertex_alloc: (constructor)
*
* Allocates a new, empty #ClutterVertex.
*
* Return value: (transfer full): the newly allocated #ClutterVertex.
* Use clutter_vertex_free() to free its resources
*
* Since: 1.12
*/
ClutterVertex *
clutter_vertex_alloc (void)
{
return g_slice_new0 (ClutterVertex);
}
/**
* clutter_vertex_init:
* @vertex: a #ClutterVertex
* @x: X coordinate
* @y: Y coordinate
* @z: Z coordinate
*
* Initializes @vertex with the given coordinates.
*
* Return value: (transfer none): the initialized #ClutterVertex
*
* Since: 1.10
*/
ClutterVertex *
clutter_vertex_init (ClutterVertex *vertex,
gfloat x,
gfloat y,
gfloat z)
{
g_return_val_if_fail (vertex != NULL, NULL);
vertex->x = x;
vertex->y = y;
vertex->z = z;
return vertex;
}
/**
* clutter_vertex_copy:
* @vertex: a #ClutterVertex
*
* Copies @vertex
*
* Return value: (transfer full): a newly allocated copy of #ClutterVertex.
* Use clutter_vertex_free() to free the allocated resources
*
* Since: 1.0
*/
ClutterVertex *
clutter_vertex_copy (const ClutterVertex *vertex)
{
if (G_LIKELY (vertex != NULL))
return g_slice_dup (ClutterVertex, vertex);
return NULL;
}
/**
* clutter_vertex_free:
* @vertex: a #ClutterVertex
*
* Frees a #ClutterVertex allocated using clutter_vertex_alloc() or
* clutter_vertex_copy().
*
* Since: 1.0
*/
void
clutter_vertex_free (ClutterVertex *vertex)
{
if (G_UNLIKELY (vertex != NULL))
g_slice_free (ClutterVertex, vertex);
}
/**
* clutter_vertex_equal:
* @vertex_a: a #ClutterVertex
* @vertex_b: a #ClutterVertex
*
* Compares @vertex_a and @vertex_b for equality
*
* Return value: %TRUE if the passed #ClutterVertex are equal
*
* Since: 1.0
*/
gboolean
clutter_vertex_equal (const ClutterVertex *vertex_a,
const ClutterVertex *vertex_b)
{
g_return_val_if_fail (vertex_a != NULL && vertex_b != NULL, FALSE);
if (vertex_a == vertex_b)
return TRUE;
return fabsf (vertex_a->x - vertex_b->x) < FLOAT_EPSILON &&
fabsf (vertex_a->y - vertex_b->y) < FLOAT_EPSILON &&
fabsf (vertex_a->z - vertex_b->z) < FLOAT_EPSILON;
}
static void
clutter_vertex_interpolate (const ClutterVertex *a,
const ClutterVertex *b,
double progress,
ClutterVertex *res)
{
res->x = a->x + (b->x - a->x) * progress;
res->y = a->y + (b->y - a->y) * progress;
res->z = a->z + (b->z - a->z) * progress;
}
static gboolean
clutter_vertex_progress (const GValue *a,
const GValue *b,
gdouble progress,
GValue *retval)
{
const ClutterVertex *av = g_value_get_boxed (a);
const ClutterVertex *bv = g_value_get_boxed (b);
ClutterVertex res;
clutter_vertex_interpolate (av, bv, progress, &res);
g_value_set_boxed (retval, &res);
return TRUE;
}
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterVertex, clutter_vertex,
clutter_vertex_copy,
clutter_vertex_free,
CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_vertex_progress));
/*
* ClutterMargin
*/
@ -1331,20 +1159,20 @@ clutter_matrix_progress (const GValue *a,
{
const ClutterMatrix *matrix1 = g_value_get_boxed (a);
const ClutterMatrix *matrix2 = g_value_get_boxed (b);
ClutterVertex scale1 = CLUTTER_VERTEX_INIT (1.f, 1.f, 1.f);
graphene_point3d_t scale1 = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
float shear1[3] = { 0.f, 0.f, 0.f };
ClutterVertex rotate1 = CLUTTER_VERTEX_INIT_ZERO;
ClutterVertex translate1 = CLUTTER_VERTEX_INIT_ZERO;
graphene_point3d_t rotate1 = GRAPHENE_POINT3D_INIT_ZERO;
graphene_point3d_t translate1 = GRAPHENE_POINT3D_INIT_ZERO;
ClutterVertex4 perspective1 = { 0.f, 0.f, 0.f, 0.f };
ClutterVertex scale2 = CLUTTER_VERTEX_INIT (1.f, 1.f, 1.f);
graphene_point3d_t scale2 = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
float shear2[3] = { 0.f, 0.f, 0.f };
ClutterVertex rotate2 = CLUTTER_VERTEX_INIT_ZERO;
ClutterVertex translate2 = CLUTTER_VERTEX_INIT_ZERO;
graphene_point3d_t rotate2 = GRAPHENE_POINT3D_INIT_ZERO;
graphene_point3d_t translate2 = GRAPHENE_POINT3D_INIT_ZERO;
ClutterVertex4 perspective2 = { 0.f, 0.f, 0.f, 0.f };
ClutterVertex scale_res = CLUTTER_VERTEX_INIT (1.f, 1.f, 1.f);
graphene_point3d_t scale_res = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
float shear_res = 0.f;
ClutterVertex rotate_res = CLUTTER_VERTEX_INIT_ZERO;
ClutterVertex translate_res = CLUTTER_VERTEX_INIT_ZERO;
graphene_point3d_t rotate_res = GRAPHENE_POINT3D_INIT_ZERO;
graphene_point3d_t translate_res = GRAPHENE_POINT3D_INIT_ZERO;
ClutterVertex4 perspective_res = { 0.f, 0.f, 0.f, 0.f };
ClutterMatrix res;
@ -1365,11 +1193,11 @@ clutter_matrix_progress (const GValue *a,
res.ww = perspective_res.w;
/* translation */
clutter_vertex_interpolate (&translate1, &translate2, progress, &translate_res);
graphene_point3d_interpolate (&translate1, &translate2, progress, &translate_res);
cogl_matrix_translate (&res, translate_res.x, translate_res.y, translate_res.z);
/* rotation */
clutter_vertex_interpolate (&rotate1, &rotate2, progress, &rotate_res);
graphene_point3d_interpolate (&rotate1, &rotate2, progress, &rotate_res);
cogl_matrix_rotate (&res, rotate_res.x, 1.0f, 0.0f, 0.0f);
cogl_matrix_rotate (&res, rotate_res.y, 0.0f, 1.0f, 0.0f);
cogl_matrix_rotate (&res, rotate_res.z, 0.0f, 0.0f, 1.0f);
@ -1388,7 +1216,7 @@ clutter_matrix_progress (const GValue *a,
_clutter_util_matrix_skew_xy (&res, shear_res);
/* scale */
clutter_vertex_interpolate (&scale1, &scale2, progress, &scale_res);
graphene_point3d_interpolate (&scale1, &scale2, progress, &scale_res);
cogl_matrix_scale (&res, scale_res.x, scale_res.y, scale_res.z);
g_value_set_boxed (retval, &res);

View File

@ -152,7 +152,9 @@ clutter_bind_constraint_update_allocation (ClutterConstraint *constraint,
ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint);
gfloat source_width, source_height;
gfloat actor_width, actor_height;
ClutterVertex source_position = { 0., };
graphene_point3d_t source_position;
source_position = GRAPHENE_POINT3D_INIT (0.f, 0.f, 0.f);
if (bind->source == NULL)
return;

View File

@ -182,7 +182,7 @@ clutter_blur_effect_get_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
{
gfloat cur_width, cur_height;
ClutterVertex origin;
graphene_point3d_t origin;
clutter_paint_volume_get_origin (volume, &origin);
cur_width = clutter_paint_volume_get_width (volume);

View File

@ -86,7 +86,7 @@ struct _ClutterOffscreenEffectPrivate
ClutterActor *actor;
ClutterActor *stage;
ClutterVertex position;
graphene_point3d_t position;
int fbo_offset_x;
int fbo_offset_y;
@ -250,9 +250,11 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
gfloat target_width = -1, target_height = -1;
gfloat resource_scale;
gfloat ceiled_resource_scale;
ClutterVertex local_offset = { 0.f, 0.f, 0.f };
graphene_point3d_t local_offset;
gfloat old_viewport[4];
local_offset = GRAPHENE_POINT3D_INIT (0.0f, 0.0f, 0.0f);
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
return FALSE;

View File

@ -58,7 +58,7 @@ struct _ClutterPaintVolume
* elements 4, 5, 6 and 7 most of the time for 2D actors when
* calculating the projected paint box.
*/
ClutterVertex vertices[8];
graphene_point3d_t vertices[8];
/* As an optimization for internally managed PaintVolumes we allow
* initializing ClutterPaintVolume variables allocated on the stack

View File

@ -63,7 +63,7 @@ _clutter_paint_volume_new (ClutterActor *actor)
pv->actor = actor;
memset (pv->vertices, 0, 8 * sizeof (ClutterVertex));
memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
pv->is_static = FALSE;
pv->is_empty = TRUE;
@ -96,7 +96,7 @@ _clutter_paint_volume_init_static (ClutterPaintVolume *pv,
{
pv->actor = actor;
memset (pv->vertices, 0, 8 * sizeof (ClutterVertex));
memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
pv->is_static = TRUE;
pv->is_empty = TRUE;
@ -170,7 +170,7 @@ clutter_paint_volume_free (ClutterPaintVolume *pv)
/**
* clutter_paint_volume_set_origin:
* @pv: a #ClutterPaintVolume
* @origin: a #ClutterVertex
* @origin: a #graphene_point3d_t
*
* Sets the origin of the paint volume.
*
@ -183,7 +183,7 @@ clutter_paint_volume_free (ClutterPaintVolume *pv)
*/
void
clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
const ClutterVertex *origin)
const graphene_point3d_t *origin)
{
static const int key_vertices[4] = { 0, 1, 3, 4 };
float dx, dy, dz;
@ -210,7 +210,7 @@ clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
/**
* clutter_paint_volume_get_origin:
* @pv: a #ClutterPaintVolume
* @vertex: (out): the return location for a #ClutterVertex
* @vertex: (out): the return location for a #graphene_point3d_t
*
* Retrieves the origin of the #ClutterPaintVolume.
*
@ -218,7 +218,7 @@ clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
*/
void
clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
ClutterVertex *vertex)
graphene_point3d_t *vertex)
{
g_return_if_fail (pv != NULL);
g_return_if_fail (vertex != NULL);
@ -659,7 +659,7 @@ clutter_paint_volume_union_box (ClutterPaintVolume *pv,
const ClutterActorBox *box)
{
ClutterPaintVolume volume;
ClutterVertex origin;
graphene_point3d_t origin;
g_return_if_fail (pv != NULL);
g_return_if_fail (box != NULL);
@ -757,7 +757,7 @@ _clutter_paint_volume_get_bounding_box (ClutterPaintVolume *pv,
ClutterActorBox *box)
{
gfloat x_min, y_min, x_max, y_max;
ClutterVertex *vertices;
graphene_point3d_t *vertices;
int count;
gint i;
@ -878,9 +878,9 @@ _clutter_paint_volume_transform (ClutterPaintVolume *pv,
cogl_matrix_transform_points (matrix,
3,
sizeof (ClutterVertex),
sizeof (graphene_point3d_t),
pv->vertices,
sizeof (ClutterVertex),
sizeof (graphene_point3d_t),
pv->vertices,
transform_count);
@ -896,7 +896,7 @@ _clutter_paint_volume_axis_align (ClutterPaintVolume *pv)
{
int count;
int i;
ClutterVertex origin;
graphene_point3d_t origin;
float max_x;
float max_y;
float max_z;
@ -1075,7 +1075,7 @@ _clutter_paint_volume_cull (ClutterPaintVolume *pv,
const ClutterPlane *planes)
{
int vertex_count;
ClutterVertex *vertices = pv->vertices;
graphene_point3d_t *vertices = pv->vertices;
gboolean partial = FALSE;
int i;
int j;

View File

@ -239,12 +239,12 @@ void _clutter_run_repaint_functions (ClutterRepaintFlags flags);
GType _clutter_layout_manager_get_child_meta_type (ClutterLayoutManager *manager);
void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
const CoglMatrix *projection,
const float *viewport,
const ClutterVertex *vertices_in,
ClutterVertex *vertices_out,
int n_vertices);
void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
const CoglMatrix *projection,
const float *viewport,
const graphene_point3d_t *vertices_in,
graphene_point3d_t *vertices_out,
int n_vertices);
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
ClutterRect *dest);
@ -297,10 +297,10 @@ void _clutter_util_matrix_skew_yz (ClutterMatrix *matrix,
float factor);
gboolean _clutter_util_matrix_decompose (const ClutterMatrix *src,
ClutterVertex *scale_p,
graphene_point3d_t *scale_p,
float shear_p[3],
ClutterVertex *rotate_p,
ClutterVertex *translate_p,
graphene_point3d_t *rotate_p,
graphene_point3d_t *translate_p,
ClutterVertex4 *perspective_p);
typedef struct _ClutterPlane

View File

@ -2787,7 +2787,7 @@ add_selection_to_paint_volume (ClutterText *text,
{
ClutterPaintVolume *total_volume = user_data;
ClutterPaintVolume rect_volume;
ClutterVertex vertex;
graphene_point3d_t vertex;
_clutter_paint_volume_init_static (&rect_volume, CLUTTER_ACTOR (text));
@ -2809,7 +2809,7 @@ clutter_text_get_paint_volume_for_cursor (ClutterText *text,
ClutterPaintVolume *volume)
{
ClutterTextPrivate *priv = text->priv;
ClutterVertex origin;
graphene_point3d_t origin;
clutter_text_ensure_cursor_position (text, resource_scale);
@ -2852,7 +2852,7 @@ clutter_text_get_paint_volume (ClutterActor *self,
{
PangoLayout *layout;
PangoRectangle ink_rect;
ClutterVertex origin;
graphene_point3d_t origin;
float resource_scale;
/* If the text is single line editable then it gets clipped to

View File

@ -33,6 +33,8 @@
#include <clutter/clutter-macros.h>
#include <clutter/clutter-enums.h>
#include <graphene-gobject.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_ACTOR_BOX (clutter_actor_box_get_type ())
@ -42,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_VERTEX (clutter_vertex_get_type ())
#define CLUTTER_TYPE_POINT (clutter_point_get_type ())
#define CLUTTER_TYPE_SIZE (clutter_size_get_type ())
#define CLUTTER_TYPE_RECT (clutter_rect_get_type ())
@ -85,7 +86,6 @@ typedef struct _ClutterPerspective ClutterPerspective;
typedef struct _ClutterPoint ClutterPoint;
typedef struct _ClutterRect ClutterRect;
typedef struct _ClutterSize ClutterSize;
typedef struct _ClutterVertex ClutterVertex;
typedef struct _ClutterAlpha ClutterAlpha;
typedef struct _ClutterAnimation ClutterAnimation;
@ -373,69 +373,6 @@ float clutter_rect_get_width (ClutterRect *rect
CLUTTER_EXPORT
float clutter_rect_get_height (ClutterRect *rect);
/**
* ClutterVertex:
* @x: X coordinate of the vertex
* @y: Y coordinate of the vertex
* @z: Z coordinate of the vertex
*
* A point in 3D space, expressed in pixels
*
* Since: 0.4
*/
struct _ClutterVertex
{
gfloat x;
gfloat y;
gfloat z;
};
/**
* CLUTTER_VERTEX_INIT:
* @x: the X coordinate of the vertex
* @y: the Y coordinate of the vertex
* @z: the Z coordinate of the vertex
*
* A simple macro for initializing a #ClutterVertex when declaring it, e.g.:
*
* |[
* ClutterVertex v = CLUTTER_VERTEX_INIT (x, y, z);
* ]|
*
* Since: 1.10
*/
#define CLUTTER_VERTEX_INIT(x,y,z) { (x), (y), (z) }
/**
* CLUTTER_VERTEX_INIT_ZERO:
*
* A simple macro for initializing a #ClutterVertex to (0, 0, 0).
*
* Since: 1.12
*/
#define CLUTTER_VERTEX_INIT_ZERO CLUTTER_VERTEX_INIT (0.f, 0.f, 0.f)
CLUTTER_EXPORT
GType clutter_vertex_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterVertex *clutter_vertex_new (gfloat x,
gfloat y,
gfloat z);
CLUTTER_EXPORT
ClutterVertex *clutter_vertex_alloc (void);
CLUTTER_EXPORT
ClutterVertex *clutter_vertex_init (ClutterVertex *vertex,
gfloat x,
gfloat y,
gfloat z);
CLUTTER_EXPORT
ClutterVertex *clutter_vertex_copy (const ClutterVertex *vertex);
CLUTTER_EXPORT
void clutter_vertex_free (ClutterVertex *vertex);
CLUTTER_EXPORT
gboolean clutter_vertex_equal (const ClutterVertex *vertex_a,
const ClutterVertex *vertex_b);
/**
* ClutterActorBox:
* @x1: X coordinate of the top left corner
@ -540,7 +477,7 @@ gboolean clutter_actor_box_contains (const ClutterActorBox *box,
gfloat y);
CLUTTER_EXPORT
void clutter_actor_box_from_vertices (ClutterActorBox *box,
const ClutterVertex verts[]);
const graphene_point3d_t verts[]);
CLUTTER_EXPORT
void clutter_actor_box_interpolate (const ClutterActorBox *initial,
const ClutterActorBox *final,
@ -672,10 +609,10 @@ void clutter_paint_volume_free (ClutterPaintVolume
CLUTTER_EXPORT
void clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
const ClutterVertex *origin);
const graphene_point3d_t *origin);
CLUTTER_EXPORT
void clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
ClutterVertex *vertex);
graphene_point3d_t *vertex);
CLUTTER_EXPORT
void clutter_paint_volume_set_width (ClutterPaintVolume *pv,
gfloat width);

View File

@ -50,8 +50,8 @@ void
_clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
const CoglMatrix *projection,
const float *viewport,
const ClutterVertex *vertices_in,
ClutterVertex *vertices_out,
const graphene_point3d_t *vertices_in,
graphene_point3d_t *vertices_out,
int n_vertices)
{
CoglMatrix modelview_projection;
@ -68,7 +68,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
modelview);
cogl_matrix_project_points (&modelview_projection,
3,
sizeof (ClutterVertex),
sizeof (graphene_point3d_t),
vertices_in,
sizeof (ClutterVertex4),
vertices_tmp,
@ -78,7 +78,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
{
cogl_matrix_transform_points (modelview,
3,
sizeof (ClutterVertex),
sizeof (graphene_point3d_t),
vertices_in,
sizeof (ClutterVertex4),
vertices_tmp,
@ -96,7 +96,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
for (i = 0; i < n_vertices; i++)
{
ClutterVertex4 vertex_tmp = vertices_tmp[i];
ClutterVertex *vertex_out = &vertices_out[i];
graphene_point3d_t *vertex_out = &vertices_out[i];
/* Finally translate from OpenGL coords to window coords */
vertex_out->x = MTX_GL_SCALE_X (vertex_tmp.x, vertex_tmp.w,
viewport[2], viewport[0]);
@ -295,48 +295,12 @@ _clutter_util_matrix_skew_yz (ClutterMatrix *matrix,
matrix->zw += matrix->yw * factor;
}
static float
_clutter_util_vertex_length (const ClutterVertex *vertex)
{
return sqrtf (vertex->x * vertex->x + vertex->y * vertex->y + vertex->z * vertex->z);
}
static void
_clutter_util_vertex_normalize (ClutterVertex *vertex)
{
float factor = _clutter_util_vertex_length (vertex);
if (factor == 0.f)
return;
vertex->x /= factor;
vertex->y /= factor;
vertex->z /= factor;
}
static float
_clutter_util_vertex_dot (const ClutterVertex *v1,
const ClutterVertex *v2)
{
return v1->x * v2->x + v1->y * v2->y + v1->z * v2->z;
}
static void
_clutter_util_vertex_cross (const ClutterVertex *v1,
const ClutterVertex *v2,
ClutterVertex *res)
{
res->x = v1->y * v2->z - v2->y * v1->z;
res->y = v1->z * v2->x - v2->z * v1->x;
res->z = v1->x * v2->y - v2->x * v1->y;
}
static void
_clutter_util_vertex_combine (const ClutterVertex *a,
const ClutterVertex *b,
double ascl,
double bscl,
ClutterVertex *res)
_clutter_util_vertex_combine (const graphene_point3d_t *a,
const graphene_point3d_t *b,
double ascl,
double bscl,
graphene_point3d_t *res)
{
res->x = (ascl * a->x) + (bscl * b->x);
res->y = (ascl * a->y) + (bscl * b->y);
@ -384,16 +348,16 @@ _clutter_util_vertex4_interpolate (const ClutterVertex4 *a,
*/
gboolean
_clutter_util_matrix_decompose (const ClutterMatrix *src,
ClutterVertex *scale_p,
graphene_point3d_t *scale_p,
float shear_p[3],
ClutterVertex *rotate_p,
ClutterVertex *translate_p,
graphene_point3d_t *rotate_p,
graphene_point3d_t *translate_p,
ClutterVertex4 *perspective_p)
{
CoglMatrix matrix = *src;
CoglMatrix perspective;
ClutterVertex4 vertex_tmp;
ClutterVertex row[3], pdum;
graphene_point3d_t row[3], pdum;
int i, j;
#define XY_SHEAR 0
@ -481,34 +445,34 @@ _clutter_util_matrix_decompose (const ClutterMatrix *src,
}
/* compute scale.x and normalize the first row */
scale_p->x = _clutter_util_vertex_length (&row[0]);
_clutter_util_vertex_normalize (&row[0]);
scale_p->x = graphene_point3d_length (&row[0]);
graphene_point3d_normalize (&row[0], &row[0]);
/* compute XY shear and make the second row orthogonal to the first */
shear_p[XY_SHEAR] = _clutter_util_vertex_dot (&row[0], &row[1]);
shear_p[XY_SHEAR] = graphene_point3d_dot (&row[0], &row[1]);
_clutter_util_vertex_combine (&row[1], &row[0],
1.0, -shear_p[XY_SHEAR],
&row[1]);
/* compute the Y scale and normalize the second row */
scale_p->y = _clutter_util_vertex_length (&row[1]);
_clutter_util_vertex_normalize (&row[1]);
scale_p->y = graphene_point3d_length (&row[1]);
graphene_point3d_normalize (&row[1], &row[1]);
shear_p[XY_SHEAR] /= scale_p->y;
/* compute XZ and YZ shears, orthogonalize the third row */
shear_p[XZ_SHEAR] = _clutter_util_vertex_dot (&row[0], &row[2]);
shear_p[XZ_SHEAR] = graphene_point3d_dot (&row[0], &row[2]);
_clutter_util_vertex_combine (&row[2], &row[0],
1.0, -shear_p[XZ_SHEAR],
&row[2]);
shear_p[YZ_SHEAR] = _clutter_util_vertex_dot (&row[1], &row[2]);
shear_p[YZ_SHEAR] = graphene_point3d_dot (&row[1], &row[2]);
_clutter_util_vertex_combine (&row[2], &row[1],
1.0, -shear_p[YZ_SHEAR],
&row[2]);
/* get the Z scale and normalize the third row*/
scale_p->z = _clutter_util_vertex_length (&row[2]);
_clutter_util_vertex_normalize (&row[2]);
scale_p->z = graphene_point3d_length (&row[2]);
graphene_point3d_normalize (&row[2], &row[2]);
shear_p[XZ_SHEAR] /= scale_p->z;
shear_p[YZ_SHEAR] /= scale_p->z;
@ -516,8 +480,8 @@ _clutter_util_matrix_decompose (const ClutterMatrix *src,
* check for a coordinate system flip; if the determinant
* is -1, then negate the matrix and scaling factors
*/
_clutter_util_vertex_cross (&row[1], &row[2], &pdum);
if (_clutter_util_vertex_dot (&row[0], &pdum) < 0.f)
graphene_point3d_cross (&row[1], &row[2], &pdum);
if (graphene_point3d_dot (&row[0], &pdum) < 0.f)
{
scale_p->x *= -1.f;

View File

@ -244,7 +244,7 @@ clutter_zoom_action_real_zoom (ClutterZoomAction *action,
ClutterZoomActionPrivate *priv = action->priv;
gfloat x, y, z;
gdouble scale_x, scale_y;
ClutterVertex out, in;
graphene_point3d_t out, in;
in.x = priv->transformed_focal_point.x;
in.y = priv->transformed_focal_point.y;

View File

@ -2222,7 +2222,7 @@ clutter_actor_animate_with_timeline (ClutterActor *actor,
*
* Will animate the "rotation-angle-z" property between the current value
* and 360 degrees, and set the "rotation-center-z" property to the fixed
* value of the #ClutterVertex "center".
* value of the #graphene_point3d_t "center".
*
* This function will implicitly create a #ClutterAnimation object which
* will be assigned to the @actor and will be returned to the developer

View File

@ -438,7 +438,7 @@ set_viewport_with_buffer_under_fbo_source (ClutterActor *fbo_source,
* falling back to a stage sized fbo with an offset of (0,0)
*/
ClutterVertex verts[4];
graphene_point3d_t verts[4];
float x_min = G_MAXFLOAT, y_min = G_MAXFLOAT;
int i;

View File

@ -99,7 +99,7 @@ notify_cb (GObject *object, GParamSpec *pspec, TestState *state)
macro so that the assertion failure will report the right line
number */
#define assert_coords(state, x_1, y_1, x_2, y_2) G_STMT_START { \
ClutterVertex verts[4]; \
graphene_point3d_t verts[4]; \
clutter_actor_get_abs_allocation_vertices ((state)->rect, verts); \
check_coords ((state), (x_1), (y_1), (x_2), (y_2), verts); \
g_assert (approx_equal ((x_1), verts[0].x)); \
@ -114,7 +114,7 @@ notify_cb (GObject *object, GParamSpec *pspec, TestState *state)
g_assert (approx_equal (v->x, xc) && \
approx_equal (v->y, yc) && \
approx_equal (v->z, zc)); \
g_boxed_free (CLUTTER_TYPE_VERTEX, v); } G_STMT_END
g_boxed_free (GRAPHENE_TYPE_POINT3D, v); } G_STMT_END
static inline gboolean
approx_equal (int a, int b)
@ -128,7 +128,7 @@ check_coords (TestState *state,
gint y_1,
gint x_2,
gint y_2,
const ClutterVertex *verts)
const graphene_point3d_t *verts)
{
if (g_test_verbose ())
g_print ("checking that (%i,%i,%i,%i) \xe2\x89\x88 (%i,%i,%i,%i): %s\n",
@ -424,7 +424,7 @@ test_rotate_center (TestState *state)
{
ClutterActor *rect = state->rect;
gdouble angle_x, angle_y, angle_z;
ClutterVertex *center_x, *center_y, *center_z;
graphene_point3d_t *center_x, *center_y, *center_z;
ClutterGravity z_center_gravity;
gfloat stage_width, stage_height;
gfloat rect_x, rect_y;

View File

@ -334,7 +334,7 @@ my_thing_allocate (ClutterActor *self,
if (clutter_actor_is_scaled (child) ||
clutter_actor_is_rotated (child))
{
ClutterVertex v1 = { 0, }, v2 = { 0, };
graphene_point3d_t v1 = { 0, }, v2 = { 0, };
ClutterActorBox transformed_box = { 0, };
/* origin */

View File

@ -66,11 +66,11 @@ round_to_fixed (float x)
* in @x_origin and @y_origin.
*/
gboolean
meta_actor_vertices_are_untransformed (ClutterVertex *verts,
float widthf,
float heightf,
int *x_origin,
int *y_origin)
meta_actor_vertices_are_untransformed (graphene_point3d_t *verts,
float widthf,
float heightf,
int *x_origin,
int *y_origin)
{
int width, height;
int v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y;
@ -119,7 +119,7 @@ meta_actor_is_untransformed (ClutterActor *actor,
int *y_origin)
{
gfloat widthf, heightf;
ClutterVertex verts[4];
graphene_point3d_t verts[4];
clutter_actor_get_size (actor, &widthf, &heightf);
clutter_actor_get_abs_allocation_vertices (actor, verts);
@ -153,7 +153,7 @@ meta_actor_painting_untransformed (CoglFramebuffer *fb,
int *y_origin)
{
CoglMatrix modelview, projection, modelview_projection;
ClutterVertex vertices[4];
graphene_point3d_t vertices[4];
float viewport[4];
int i;

View File

@ -23,11 +23,11 @@
#include "clutter/clutter.h"
gboolean meta_actor_vertices_are_untransformed (ClutterVertex *verts,
float widthf,
float heightf,
int *x_origin,
int *y_origin);
gboolean meta_actor_vertices_are_untransformed (graphene_point3d_t *verts,
float widthf,
float heightf,
int *x_origin,
int *y_origin);
gboolean meta_actor_is_untransformed (ClutterActor *actor,
int *x_origin,
int *y_origin);

View File

@ -1890,7 +1890,7 @@ meta_window_actor_transform_relative_position (MetaScreenCastWindow *screen_cast
meta_window_actor_get_instance_private (window_actor);
MetaShapedTexture *stex;
MetaRectangle bounds;
ClutterVertex v1 = { 0.f, }, v2 = { 0.f, };
graphene_point3d_t v1 = { 0.f, }, v2 = { 0.f, };
meta_window_actor_get_frame_bounds (screen_cast_window, &bounds);

View File

@ -1588,11 +1588,11 @@ meta_wayland_surface_get_absolute_coordinates (MetaWaylandSurface *surface,
{
ClutterActor *actor =
CLUTTER_ACTOR (meta_surface_actor_get_texture (meta_wayland_surface_get_actor (surface)));
ClutterVertex sv = {
graphene_point3d_t sv = {
.x = sx * surface->scale,
.y = sy * surface->scale,
};
ClutterVertex v = { 0 };
graphene_point3d_t v = { 0 };
clutter_actor_apply_relative_transform_to_point (actor, NULL, &sv, &v);