summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2015-09-10 16:12:51 +0800
committerJonas Ådahl <jadahl@gmail.com>2015-09-11 10:36:52 +0800
commit5d83260b19c06f216cfdb21a57f256ebee1affef (patch)
treef71a7749f5e2da49751f95a50c911dac6d9b6ef3
parent63813ad398a38d5d7f304c497a1c3f0fda92bdd7 (diff)
downloadclutter-5d83260b19c06f216cfdb21a57f256ebee1affef.tar.gz
actor: Fix transforming stage point when scale is less than 1
The commit 6cd24faaa54de3246ca45d1c7426d8b7a74f71db (actor: Clean up transform_stage_point()) changed the validation of the transformation matrix to ignore the fraction part of the determinant. This caused clutter_actor_transform_stage_point() to fail and return FALSE for actors which scale was less than 1. Previously the validation was ('det' being a float): det = (RQ[0][0] * ST[0][0]) + (RQ[0][1] * ST[0][1]) + (RQ[0][2] * ST[0][2]); if (!det) return FALSE; Semantically, the if statement expression '!det' is equivalent to 'det == 0', i.e. 'det == 0.0f'. Post cleanup patches, 'det' was turned into a double, and the if statement was changed to: if (CLUTTER_NEARBYINT (det) == 0) return FALSE; which, different from before, rounds the determinant to the nearest integer value, meaning determinant in the range (-0.5, 0.5) would be considered invalid. This patch reverts this part to the old behavior, while, because of the inexact nature of floating point arithmetics, allowing a bit more liberal meaning of "equals to 0" than '== 0.0'. https://bugzilla.gnome.org/show_bug.cgi?id=754766
-rw-r--r--clutter/clutter-actor.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 1cbbd5c5f..ad106c452 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -15190,8 +15190,8 @@ clutter_actor_transform_stage_point (ClutterActor *self,
dy2 = v[2].y - v[3].y;
det = DET (dx1, dx2, dy1, dy2);
- if (CLUTTER_NEARBYINT (det) == 0)
- return FALSE;
+ if (fabs (det) <= DBL_EPSILON)
+ return FALSE;
RQ[0][2] = DET (px, dx2, py, dy2) / det;
RQ[1][2] = DET (dx1, px, dy1, py) / det;
@@ -15236,7 +15236,7 @@ clutter_actor_transform_stage_point (ClutterActor *self,
det = (RQ[0][0] * ST[0][0])
+ (RQ[0][1] * ST[0][1])
+ (RQ[0][2] * ST[0][2]);
- if (CLUTTER_NEARBYINT (det) == 0)
+ if (fabs (det) <= DBL_EPSILON)
return FALSE;
/*