summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2012-06-27 21:27:20 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2012-08-11 10:31:09 +0100
commitc2c1a0a733e1dd4d3f123d4853e3752f6b65794d (patch)
treedc4ad31abf282c8ae3f678dbdd1c7177680fbed7
parent70b7955de0bde0b8ac129ab5f9d7ba8fbad0df3f (diff)
downloadclutter-c2c1a0a733e1dd4d3f123d4853e3752f6b65794d.tar.gz
constraints: Clamp updated allocation to the nearest pixel
Use Clutter.ActorBox.clamp_to_pixel() to do it properly. (cherry picked from commit 0ba2d1df93d4083e721d934ed400446ba76af1d3) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
-rw-r--r--clutter/clutter-align-constraint.c6
-rw-r--r--clutter/clutter-bind-constraint.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/clutter/clutter-align-constraint.c b/clutter/clutter-align-constraint.c
index 83136c2ec..8c84f356b 100644
--- a/clutter/clutter-align-constraint.c
+++ b/clutter/clutter-align-constraint.c
@@ -152,14 +152,12 @@ clutter_align_constraint_update_allocation (ClutterConstraint *constraint,
case CLUTTER_ALIGN_X_AXIS:
allocation->x1 = ((source_width - actor_width) * align->factor)
+ source_x;
- allocation->x1 = floorf (allocation->x1 + 0.5);
allocation->x2 = allocation->x1 + actor_width;
break;
case CLUTTER_ALIGN_Y_AXIS:
allocation->y1 = ((source_height - actor_height) * align->factor)
+ source_y;
- allocation->y1 = floorf (allocation->y1 + 0.5);
allocation->y2 = allocation->y1 + actor_height;
break;
@@ -168,8 +166,6 @@ clutter_align_constraint_update_allocation (ClutterConstraint *constraint,
+ source_x;
allocation->y1 = ((source_height - actor_height) * align->factor)
+ source_y;
- allocation->x1 = floorf (allocation->x1 + 0.5f);
- allocation->y1 = floorf (allocation->y1 + 0.5f);
allocation->x2 = allocation->x1 + actor_width;
allocation->y2 = allocation->y1 + actor_height;
break;
@@ -178,6 +174,8 @@ clutter_align_constraint_update_allocation (ClutterConstraint *constraint,
g_assert_not_reached ();
break;
}
+
+ clutter_actor_box_clamp_to_pixel (allocation);
}
static void
diff --git a/clutter/clutter-bind-constraint.c b/clutter/clutter-bind-constraint.c
index 51b3e35ef..1e1d9e8bd 100644
--- a/clutter/clutter-bind-constraint.c
+++ b/clutter/clutter-bind-constraint.c
@@ -223,6 +223,8 @@ clutter_bind_constraint_update_allocation (ClutterConstraint *constraint,
g_assert_not_reached ();
break;
}
+
+ clutter_actor_box_clamp_to_pixel (allocation);
}
static void