From 850f956d4e2a811eb663575dcd6ae41f09b992de Mon Sep 17 00:00:00 2001 From: Adel Gadllah Date: Wed, 5 Jan 2011 10:24:26 +0100 Subject: [PATCH] ClutterAlignConstraint: Keep pixel aligment We have to round the values here otherwise we might end up with misaligned actors. http://bugzilla.clutter-project.org/show_bug.cgi?id=2508 --- clutter/clutter-align-constraint.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clutter/clutter-align-constraint.c b/clutter/clutter-align-constraint.c index a429df912..f1bd82f3b 100644 --- a/clutter/clutter-align-constraint.c +++ b/clutter/clutter-align-constraint.c @@ -45,6 +45,8 @@ #include "clutter-enum-types.h" #include "clutter-private.h" +#include + #define CLUTTER_ALIGN_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraintClass)) #define CLUTTER_IS_ALIGN_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ALIGN_CONSTRAINT)) #define CLUTTER_ALIGN_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraintClass)) @@ -136,6 +138,7 @@ clutter_align_constraint_update_allocation (ClutterConstraint *constraint, actor_width = clutter_actor_box_get_width (allocation); allocation->x1 = ((source_width - actor_width) * align->factor) + source_x; + allocation->x1 = floorf (allocation->x1 + 0.5); allocation->x2 = allocation->x1 + actor_width; break; @@ -143,6 +146,7 @@ clutter_align_constraint_update_allocation (ClutterConstraint *constraint, actor_height = clutter_actor_box_get_height (allocation); allocation->y1 = ((source_height - actor_height) * align->factor) + source_y; + allocation->x1 = floorf (allocation->x1 + 0.5); allocation->y2 = allocation->y1 + actor_height; break;