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
This commit is contained in:
Adel Gadllah 2011-01-05 10:24:26 +01:00 committed by Emmanuele Bassi
parent d648de7d14
commit 850f956d4e

View File

@ -45,6 +45,8 @@
#include "clutter-enum-types.h"
#include "clutter-private.h"
#include <math.h>
#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;