mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
Replace ClutterGeometry by graphene_rect_t
The last of the replacements. It is fine for now to replace ClutterGeometry's integers by floats. https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
This commit is contained in:
parent
94682e69aa
commit
bdf5e3f357
@ -11458,8 +11458,7 @@ clutter_actor_set_y (ClutterActor *self,
|
|||||||
* the X coordinate of the origin of the allocation box.
|
* the X coordinate of the origin of the allocation box.
|
||||||
*
|
*
|
||||||
* If the actor has any fixed coordinate set using clutter_actor_set_x(),
|
* If the actor has any fixed coordinate set using clutter_actor_set_x(),
|
||||||
* clutter_actor_set_position() or clutter_actor_set_geometry(), this
|
* clutter_actor_set_position(), this function will return that coordinate.
|
||||||
* function will return that coordinate.
|
|
||||||
*
|
*
|
||||||
* If both the allocation and a fixed position are missing, this function
|
* If both the allocation and a fixed position are missing, this function
|
||||||
* will return 0.
|
* will return 0.
|
||||||
@ -11506,8 +11505,7 @@ clutter_actor_get_x (ClutterActor *self)
|
|||||||
* the Y coordinate of the origin of the allocation box.
|
* the Y coordinate of the origin of the allocation box.
|
||||||
*
|
*
|
||||||
* If the actor has any fixed coordinate set using clutter_actor_set_y(),
|
* If the actor has any fixed coordinate set using clutter_actor_set_y(),
|
||||||
* clutter_actor_set_position() or clutter_actor_set_geometry(), this
|
* clutter_actor_set_position(), this function will return that coordinate.
|
||||||
* function will return that coordinate.
|
|
||||||
*
|
*
|
||||||
* If both the allocation and a fixed position are missing, this function
|
* If both the allocation and a fixed position are missing, this function
|
||||||
* will return 0.
|
* will return 0.
|
||||||
|
@ -41,114 +41,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 #graphene_rect_t and graphene_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 #graphene_rect_t and graphene_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));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ClutterMargin
|
* ClutterMargin
|
||||||
*/
|
*/
|
||||||
|
@ -352,63 +352,64 @@ _clutter_script_parse_knot (ClutterScript *script,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
parse_geometry_from_array (JsonArray *array,
|
parse_rect_from_array (JsonArray *array,
|
||||||
ClutterGeometry *geometry)
|
graphene_rect_t *rect)
|
||||||
{
|
{
|
||||||
if (json_array_get_length (array) != 4)
|
if (json_array_get_length (array) != 4)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
geometry->x = json_array_get_int_element (array, 0);
|
graphene_rect_init (rect,
|
||||||
geometry->y = json_array_get_int_element (array, 1);
|
json_array_get_int_element (array, 0),
|
||||||
geometry->width = json_array_get_int_element (array, 2);
|
json_array_get_int_element (array, 1),
|
||||||
geometry->height = json_array_get_int_element (array, 3);
|
json_array_get_int_element (array, 2),
|
||||||
|
json_array_get_int_element (array, 3));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
parse_geometry_from_object (JsonObject *object,
|
parse_rect_from_object (JsonObject *object,
|
||||||
ClutterGeometry *geometry)
|
graphene_rect_t *rect)
|
||||||
{
|
{
|
||||||
if (json_object_has_member (object, "x"))
|
if (json_object_has_member (object, "x"))
|
||||||
geometry->x = json_object_get_int_member (object, "x");
|
rect->origin.x = json_object_get_int_member (object, "x");
|
||||||
else
|
else
|
||||||
geometry->x = 0;
|
rect->origin.x = 0;
|
||||||
|
|
||||||
if (json_object_has_member (object, "y"))
|
if (json_object_has_member (object, "y"))
|
||||||
geometry->y = json_object_get_int_member (object, "y");
|
rect->origin.y = json_object_get_int_member (object, "y");
|
||||||
else
|
else
|
||||||
geometry->y = 0;
|
rect->origin.y = 0;
|
||||||
|
|
||||||
if (json_object_has_member (object, "width"))
|
if (json_object_has_member (object, "width"))
|
||||||
geometry->width = json_object_get_int_member (object, "width");
|
rect->size.width = json_object_get_int_member (object, "width");
|
||||||
else
|
else
|
||||||
geometry->width = 0;
|
rect->size.width = 0;
|
||||||
|
|
||||||
if (json_object_has_member (object, "height"))
|
if (json_object_has_member (object, "height"))
|
||||||
geometry->height = json_object_get_int_member (object, "height");
|
rect->size.height = json_object_get_int_member (object, "height");
|
||||||
else
|
else
|
||||||
geometry->height = 0;
|
rect->size.height = 0;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_clutter_script_parse_geometry (ClutterScript *script,
|
_clutter_script_parse_rect (ClutterScript *script,
|
||||||
JsonNode *node,
|
JsonNode *node,
|
||||||
ClutterGeometry *geometry)
|
graphene_rect_t *rect)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
|
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
|
||||||
g_return_val_if_fail (node != NULL, FALSE);
|
g_return_val_if_fail (node != NULL, FALSE);
|
||||||
g_return_val_if_fail (geometry != NULL, FALSE);
|
g_return_val_if_fail (rect != NULL, FALSE);
|
||||||
|
|
||||||
switch (JSON_NODE_TYPE (node))
|
switch (JSON_NODE_TYPE (node))
|
||||||
{
|
{
|
||||||
case JSON_NODE_ARRAY:
|
case JSON_NODE_ARRAY:
|
||||||
return parse_geometry_from_array (json_node_get_array (node), geometry);
|
return parse_rect_from_array (json_node_get_array (node), rect);
|
||||||
|
|
||||||
case JSON_NODE_OBJECT:
|
case JSON_NODE_OBJECT:
|
||||||
return parse_geometry_from_object (json_node_get_object (node), geometry);
|
return parse_rect_from_object (json_node_get_object (node), rect);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1328,11 +1329,11 @@ _clutter_script_parse_node (ClutterScript *script,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (p_type == CLUTTER_TYPE_GEOMETRY)
|
else if (p_type == GRAPHENE_TYPE_RECT)
|
||||||
{
|
{
|
||||||
ClutterGeometry geom = { 0, };
|
graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
|
||||||
|
|
||||||
/* geometry := {
|
/* rect := {
|
||||||
* "x" : (int),
|
* "x" : (int),
|
||||||
* "y" : (int),
|
* "y" : (int),
|
||||||
* "width" : (int),
|
* "width" : (int),
|
||||||
@ -1340,9 +1341,9 @@ _clutter_script_parse_node (ClutterScript *script,
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (_clutter_script_parse_geometry (script, node, &geom))
|
if (_clutter_script_parse_rect (script, node, &rect))
|
||||||
{
|
{
|
||||||
g_value_set_boxed (value, &geom);
|
g_value_set_boxed (value, &rect);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1417,15 +1418,15 @@ _clutter_script_parse_node (ClutterScript *script,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_GEOMETRY))
|
else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_RECT))
|
||||||
{
|
{
|
||||||
ClutterGeometry geom = { 0, };
|
graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
|
||||||
|
|
||||||
/* geometry := [ (int), (int), (int), (int) ] */
|
/* rect := [ (int), (int), (int), (int) ] */
|
||||||
|
|
||||||
if (_clutter_script_parse_geometry (script, node, &geom))
|
if (_clutter_script_parse_rect (script, node, &rect))
|
||||||
{
|
{
|
||||||
g_value_set_boxed (value, &geom);
|
g_value_set_boxed (value, &rect);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,9 +122,9 @@ gboolean _clutter_script_flags_from_string (GType gtype,
|
|||||||
gboolean _clutter_script_parse_knot (ClutterScript *script,
|
gboolean _clutter_script_parse_knot (ClutterScript *script,
|
||||||
JsonNode *node,
|
JsonNode *node,
|
||||||
ClutterKnot *knot);
|
ClutterKnot *knot);
|
||||||
gboolean _clutter_script_parse_geometry (ClutterScript *script,
|
gboolean _clutter_script_parse_rect (ClutterScript *script,
|
||||||
JsonNode *node,
|
JsonNode *node,
|
||||||
ClutterGeometry *geometry);
|
graphene_rect_t *rect);
|
||||||
gboolean _clutter_script_parse_color (ClutterScript *script,
|
gboolean _clutter_script_parse_color (ClutterScript *script,
|
||||||
JsonNode *node,
|
JsonNode *node,
|
||||||
ClutterColor *color);
|
ClutterColor *color);
|
||||||
|
@ -1353,17 +1353,9 @@ clutter_text_ensure_cursor_position (ClutterText *self,
|
|||||||
|
|
||||||
if (!graphene_rect_equal (&priv->cursor_rect, &cursor_rect))
|
if (!graphene_rect_equal (&priv->cursor_rect, &cursor_rect))
|
||||||
{
|
{
|
||||||
ClutterGeometry cursor_pos;
|
|
||||||
|
|
||||||
priv->cursor_rect = cursor_rect;
|
priv->cursor_rect = cursor_rect;
|
||||||
|
|
||||||
/* XXX:2.0 - remove */
|
g_signal_emit (self, text_signals[CURSOR_EVENT], 0, &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);
|
g_signal_emit (self, text_signals[CURSOR_CHANGED], 0);
|
||||||
|
|
||||||
update_cursor_location (self);
|
update_cursor_location (self);
|
||||||
@ -4399,10 +4391,10 @@ clutter_text_class_init (ClutterTextClass *klass)
|
|||||||
/**
|
/**
|
||||||
* ClutterText::cursor-event:
|
* ClutterText::cursor-event:
|
||||||
* @self: the #ClutterText that emitted the signal
|
* @self: the #ClutterText that emitted the signal
|
||||||
* @geometry: the coordinates of the cursor
|
* @rect: the coordinates of the cursor
|
||||||
*
|
*
|
||||||
* The ::cursor-event signal is emitted whenever the cursor position
|
* The ::cursor-event signal is emitted whenever the cursor position
|
||||||
* changes inside a #ClutterText actor. Inside @geometry it is stored
|
* changes inside a #ClutterText actor. Inside @rect it is stored
|
||||||
* the current position and size of the cursor, relative to the actor
|
* the current position and size of the cursor, relative to the actor
|
||||||
* itself.
|
* itself.
|
||||||
*
|
*
|
||||||
@ -4417,7 +4409,7 @@ clutter_text_class_init (ClutterTextClass *klass)
|
|||||||
G_STRUCT_OFFSET (ClutterTextClass, cursor_event),
|
G_STRUCT_OFFSET (ClutterTextClass, cursor_event),
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
CLUTTER_TYPE_GEOMETRY | G_SIGNAL_TYPE_STATIC_SCOPE);
|
GRAPHENE_TYPE_RECT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterText::cursor-changed:
|
* ClutterText::cursor-changed:
|
||||||
|
@ -82,7 +82,7 @@ struct _ClutterTextClass
|
|||||||
void (* text_changed) (ClutterText *self);
|
void (* text_changed) (ClutterText *self);
|
||||||
void (* activate) (ClutterText *self);
|
void (* activate) (ClutterText *self);
|
||||||
void (* cursor_event) (ClutterText *self,
|
void (* cursor_event) (ClutterText *self,
|
||||||
const ClutterGeometry *geometry);
|
const graphene_rect_t *rect);
|
||||||
void (* cursor_changed) (ClutterText *self);
|
void (* cursor_changed) (ClutterText *self);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_ACTOR_BOX (clutter_actor_box_get_type ())
|
#define CLUTTER_TYPE_ACTOR_BOX (clutter_actor_box_get_type ())
|
||||||
#define CLUTTER_TYPE_GEOMETRY (clutter_geometry_get_type ())
|
|
||||||
#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ())
|
#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ())
|
||||||
#define CLUTTER_TYPE_MARGIN (clutter_margin_get_type ())
|
#define CLUTTER_TYPE_MARGIN (clutter_margin_get_type ())
|
||||||
#define CLUTTER_TYPE_MATRIX (clutter_matrix_get_type ())
|
#define CLUTTER_TYPE_MATRIX (clutter_matrix_get_type ())
|
||||||
@ -76,7 +75,6 @@ typedef struct _ClutterPathNode ClutterPathNode;
|
|||||||
|
|
||||||
typedef struct _ClutterActorBox ClutterActorBox;
|
typedef struct _ClutterActorBox ClutterActorBox;
|
||||||
typedef struct _ClutterColor ClutterColor;
|
typedef struct _ClutterColor ClutterColor;
|
||||||
typedef struct _ClutterGeometry ClutterGeometry; /* XXX:2.0 - remove */
|
|
||||||
typedef struct _ClutterKnot ClutterKnot;
|
typedef struct _ClutterKnot ClutterKnot;
|
||||||
typedef struct _ClutterMargin ClutterMargin;
|
typedef struct _ClutterMargin ClutterMargin;
|
||||||
typedef struct _ClutterPerspective ClutterPerspective;
|
typedef struct _ClutterPerspective ClutterPerspective;
|
||||||
@ -259,41 +257,6 @@ CLUTTER_EXPORT
|
|||||||
void clutter_actor_box_scale (ClutterActorBox *box,
|
void clutter_actor_box_scale (ClutterActorBox *box,
|
||||||
gfloat scale);
|
gfloat scale);
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterGeometry:
|
|
||||||
* @x: X coordinate of the top left corner of an actor
|
|
||||||
* @y: Y coordinate of the top left corner of an actor
|
|
||||||
* @width: width of an actor
|
|
||||||
* @height: height of an actor
|
|
||||||
*
|
|
||||||
* 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 #graphene_rect_t if you
|
|
||||||
* need a rectangle type, depending on the precision required.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.16
|
|
||||||
*/
|
|
||||||
struct _ClutterGeometry
|
|
||||||
{
|
|
||||||
/*< public >*/
|
|
||||||
gint x;
|
|
||||||
gint y;
|
|
||||||
guint width;
|
|
||||||
guint height;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType clutter_geometry_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
void clutter_geometry_union (const ClutterGeometry *geometry_a,
|
|
||||||
const ClutterGeometry *geometry_b,
|
|
||||||
ClutterGeometry *result);
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
gboolean clutter_geometry_intersects (const ClutterGeometry *geometry0,
|
|
||||||
const ClutterGeometry *geometry1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterKnot:
|
* ClutterKnot:
|
||||||
* @x: X coordinate of the knot
|
* @x: X coordinate of the knot
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
#include "clutter-build-config.h"
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
|
|
||||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
#include "deprecated/clutter-actor.h"
|
|
||||||
|
|
||||||
#include "clutter-actor-private.h"
|
|
||||||
#include "clutter-private.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_actor_get_allocation_geometry:
|
|
||||||
* @self: A #ClutterActor
|
|
||||||
* @geom: (out): allocation geometry in pixels
|
|
||||||
*
|
|
||||||
* Gets the layout box an actor has been assigned. The allocation can
|
|
||||||
* only be assumed valid inside a paint() method; anywhere else, it
|
|
||||||
* may be out-of-date.
|
|
||||||
*
|
|
||||||
* An allocation does not incorporate the actor's scale or anchor point;
|
|
||||||
* those transformations do not affect layout, only rendering.
|
|
||||||
*
|
|
||||||
* The returned rectangle is in pixels.
|
|
||||||
*
|
|
||||||
* Since: 0.8
|
|
||||||
*
|
|
||||||
* Deprecated: 1.12: Use clutter_actor_get_allocation_box() instead.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_actor_get_allocation_geometry (ClutterActor *self,
|
|
||||||
ClutterGeometry *geom)
|
|
||||||
{
|
|
||||||
ClutterActorBox box;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
||||||
g_return_if_fail (geom != NULL);
|
|
||||||
|
|
||||||
clutter_actor_get_allocation_box (self, &box);
|
|
||||||
|
|
||||||
geom->x = CLUTTER_NEARBYINT (clutter_actor_box_get_x (&box));
|
|
||||||
geom->y = CLUTTER_NEARBYINT (clutter_actor_box_get_y (&box));
|
|
||||||
geom->width = CLUTTER_NEARBYINT (clutter_actor_box_get_width (&box));
|
|
||||||
geom->height = CLUTTER_NEARBYINT (clutter_actor_box_get_height (&box));
|
|
||||||
}
|
|
@ -145,10 +145,6 @@ CLUTTER_DEPRECATED
|
|||||||
void clutter_actor_get_transformation_matrix (ClutterActor *self,
|
void clutter_actor_get_transformation_matrix (ClutterActor *self,
|
||||||
ClutterMatrix *matrix);
|
ClutterMatrix *matrix);
|
||||||
|
|
||||||
CLUTTER_DEPRECATED_FOR (clutter_actor_get_allocation_box)
|
|
||||||
void clutter_actor_get_allocation_geometry (ClutterActor *self,
|
|
||||||
ClutterGeometry *geom);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_ACTOR_DEPRECATED_H__ */
|
#endif /* __CLUTTER_ACTOR_DEPRECATED_H__ */
|
||||||
|
@ -84,7 +84,7 @@ clutter_rectangle_paint (ClutterActor *self)
|
|||||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||||
static CoglPipeline *default_color_pipeline = NULL;
|
static CoglPipeline *default_color_pipeline = NULL;
|
||||||
CoglPipeline *content_pipeline;
|
CoglPipeline *content_pipeline;
|
||||||
ClutterGeometry geom;
|
ClutterActorBox alloc;
|
||||||
CoglColor color;
|
CoglColor color;
|
||||||
guint8 tmp_alpha;
|
guint8 tmp_alpha;
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ clutter_rectangle_paint (ClutterActor *self)
|
|||||||
"painting rect '%s'",
|
"painting rect '%s'",
|
||||||
clutter_actor_get_name (self) ? clutter_actor_get_name (self)
|
clutter_actor_get_name (self) ? clutter_actor_get_name (self)
|
||||||
: "unknown");
|
: "unknown");
|
||||||
clutter_actor_get_allocation_geometry (self, &geom);
|
clutter_actor_get_allocation_box (self, &alloc);
|
||||||
|
|
||||||
if (G_UNLIKELY (default_color_pipeline == NULL))
|
if (G_UNLIKELY (default_color_pipeline == NULL))
|
||||||
{
|
{
|
||||||
@ -140,40 +140,41 @@ clutter_rectangle_paint (ClutterActor *self)
|
|||||||
/* We paint the border and the content only if the rectangle
|
/* We paint the border and the content only if the rectangle
|
||||||
* is big enough to show them
|
* is big enough to show them
|
||||||
*/
|
*/
|
||||||
if ((priv->border_width * 2) < geom.width &&
|
if ((priv->border_width * 2) < clutter_actor_box_get_width (&alloc) &&
|
||||||
(priv->border_width * 2) < geom.height)
|
(priv->border_width * 2) < clutter_actor_box_get_height (&alloc))
|
||||||
{
|
{
|
||||||
/* paint the border. this sucks, but it's the only way to make a border */
|
/* paint the border. this sucks, but it's the only way to make a border */
|
||||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
border_pipeline,
|
border_pipeline,
|
||||||
priv->border_width, 0,
|
priv->border_width, 0,
|
||||||
geom.width,
|
clutter_actor_box_get_width (&alloc),
|
||||||
priv->border_width);
|
priv->border_width);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
border_pipeline,
|
border_pipeline,
|
||||||
geom.width - priv->border_width,
|
clutter_actor_box_get_width (&alloc) - priv->border_width,
|
||||||
priv->border_width,
|
priv->border_width,
|
||||||
geom.width, geom.height);
|
clutter_actor_box_get_width (&alloc),
|
||||||
|
clutter_actor_box_get_height (&alloc));
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
border_pipeline,
|
border_pipeline,
|
||||||
0, geom.height - priv->border_width,
|
0, clutter_actor_box_get_height (&alloc) - priv->border_width,
|
||||||
geom.width - priv->border_width,
|
clutter_actor_box_get_width (&alloc) - priv->border_width,
|
||||||
geom.height);
|
clutter_actor_box_get_height (&alloc));
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
border_pipeline,
|
border_pipeline,
|
||||||
0, 0,
|
0, 0,
|
||||||
priv->border_width,
|
priv->border_width,
|
||||||
geom.height - priv->border_width);
|
clutter_actor_box_get_height (&alloc) - priv->border_width);
|
||||||
|
|
||||||
/* now paint the rectangle */
|
/* now paint the rectangle */
|
||||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
content_pipeline,
|
content_pipeline,
|
||||||
priv->border_width, priv->border_width,
|
priv->border_width, priv->border_width,
|
||||||
geom.width - priv->border_width,
|
clutter_actor_box_get_width (&alloc) - priv->border_width,
|
||||||
geom.height - priv->border_width);
|
clutter_actor_box_get_height (&alloc) - priv->border_width);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -183,7 +184,9 @@ clutter_rectangle_paint (ClutterActor *self)
|
|||||||
*/
|
*/
|
||||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
border_pipeline,
|
border_pipeline,
|
||||||
0, 0, geom.width, geom.height);
|
0, 0,
|
||||||
|
clutter_actor_box_get_width (&alloc),
|
||||||
|
clutter_actor_box_get_height (&alloc));
|
||||||
}
|
}
|
||||||
|
|
||||||
cogl_object_unref (border_pipeline);
|
cogl_object_unref (border_pipeline);
|
||||||
@ -192,7 +195,9 @@ clutter_rectangle_paint (ClutterActor *self)
|
|||||||
{
|
{
|
||||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
content_pipeline,
|
content_pipeline,
|
||||||
0, 0, geom.width, geom.height);
|
0, 0,
|
||||||
|
clutter_actor_box_get_width (&alloc),
|
||||||
|
clutter_actor_box_get_height (&alloc));
|
||||||
}
|
}
|
||||||
|
|
||||||
cogl_object_unref (content_pipeline);
|
cogl_object_unref (content_pipeline);
|
||||||
|
@ -242,7 +242,6 @@ clutter_deprecated_headers = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
clutter_deprecated_sources = [
|
clutter_deprecated_sources = [
|
||||||
'deprecated/clutter-actor-deprecated.c',
|
|
||||||
'deprecated/clutter-alpha.c',
|
'deprecated/clutter-alpha.c',
|
||||||
'deprecated/clutter-animation.c',
|
'deprecated/clutter-animation.c',
|
||||||
'deprecated/clutter-behaviour.c',
|
'deprecated/clutter-behaviour.c',
|
||||||
|
@ -1095,7 +1095,7 @@ meta_shaped_texture_set_transform (MetaShapedTexture *stex,
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_shaped_texture_set_viewport_src_rect (MetaShapedTexture *stex,
|
meta_shaped_texture_set_viewport_src_rect (MetaShapedTexture *stex,
|
||||||
graphene_rect_t *src_rect)
|
graphene_rect_t *src_rect)
|
||||||
{
|
{
|
||||||
if (!stex->has_viewport_src_rect ||
|
if (!stex->has_viewport_src_rect ||
|
||||||
stex->viewport_src_rect.origin.x != src_rect->origin.x ||
|
stex->viewport_src_rect.origin.x != src_rect->origin.x ||
|
||||||
|
Loading…
Reference in New Issue
Block a user