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:
Georges Basile Stavracas Neto
2019-02-20 12:50:15 -03:00
parent 94682e69aa
commit bdf5e3f357
12 changed files with 63 additions and 261 deletions

View File

@@ -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));
}

View File

@@ -145,10 +145,6 @@ CLUTTER_DEPRECATED
void clutter_actor_get_transformation_matrix (ClutterActor *self,
ClutterMatrix *matrix);
CLUTTER_DEPRECATED_FOR (clutter_actor_get_allocation_box)
void clutter_actor_get_allocation_geometry (ClutterActor *self,
ClutterGeometry *geom);
G_END_DECLS
#endif /* __CLUTTER_ACTOR_DEPRECATED_H__ */

View File

@@ -84,7 +84,7 @@ clutter_rectangle_paint (ClutterActor *self)
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
static CoglPipeline *default_color_pipeline = NULL;
CoglPipeline *content_pipeline;
ClutterGeometry geom;
ClutterActorBox alloc;
CoglColor color;
guint8 tmp_alpha;
@@ -92,7 +92,7 @@ clutter_rectangle_paint (ClutterActor *self)
"painting rect '%s'",
clutter_actor_get_name (self) ? clutter_actor_get_name (self)
: "unknown");
clutter_actor_get_allocation_geometry (self, &geom);
clutter_actor_get_allocation_box (self, &alloc);
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
* is big enough to show them
*/
if ((priv->border_width * 2) < geom.width &&
(priv->border_width * 2) < geom.height)
if ((priv->border_width * 2) < clutter_actor_box_get_width (&alloc) &&
(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 */
cogl_framebuffer_draw_rectangle (framebuffer,
border_pipeline,
priv->border_width, 0,
geom.width,
clutter_actor_box_get_width (&alloc),
priv->border_width);
cogl_framebuffer_draw_rectangle (framebuffer,
border_pipeline,
geom.width - priv->border_width,
clutter_actor_box_get_width (&alloc) - 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,
border_pipeline,
0, geom.height - priv->border_width,
geom.width - priv->border_width,
geom.height);
0, clutter_actor_box_get_height (&alloc) - priv->border_width,
clutter_actor_box_get_width (&alloc) - priv->border_width,
clutter_actor_box_get_height (&alloc));
cogl_framebuffer_draw_rectangle (framebuffer,
border_pipeline,
0, 0,
priv->border_width,
geom.height - priv->border_width);
clutter_actor_box_get_height (&alloc) - priv->border_width);
/* now paint the rectangle */
cogl_framebuffer_draw_rectangle (framebuffer,
content_pipeline,
priv->border_width, priv->border_width,
geom.width - priv->border_width,
geom.height - priv->border_width);
clutter_actor_box_get_width (&alloc) - priv->border_width,
clutter_actor_box_get_height (&alloc) - priv->border_width);
}
else
{
@@ -183,7 +184,9 @@ clutter_rectangle_paint (ClutterActor *self)
*/
cogl_framebuffer_draw_rectangle (framebuffer,
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);
@@ -192,7 +195,9 @@ clutter_rectangle_paint (ClutterActor *self)
{
cogl_framebuffer_draw_rectangle (framebuffer,
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);