summaryrefslogtreecommitdiffstats
path: root/ui/gfx
diff options
context:
space:
mode:
authorsuzyh <suzyh@chromium.org>2015-04-12 21:39:49 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-13 04:40:12 +0000
commit011864db33fa4824dd22b46a73831624bf04c9ff (patch)
tree66846a0226fa518a1591a0462dfd0f3bd268a047 /ui/gfx
parent349f0c7e92cb5b32e8acb66cad6196bc437f3d91 (diff)
downloadchromium_src-011864db33fa4824dd22b46a73831624bf04c9ff.zip
chromium_src-011864db33fa4824dd22b46a73831624bf04c9ff.tar.gz
chromium_src-011864db33fa4824dd22b46a73831624bf04c9ff.tar.bz2
Undo issue 14983004 to conform to spec.
This change reverts the change in issue 14983004 (gfx::BlendDecomposedTransforms should interpolate rotations along the shortest path). Although it may be desirable for the interpolation to occur along the shortest path (as discussed in http://lists.w3.org/Archives/Public/www-style/2013May/0131.html), the spec has not been changed. So this patch brings ui/gfx back in line with the spec. BUG= Review URL: https://codereview.chromium.org/1039993003 Cr-Commit-Position: refs/heads/master@{#324816}
Diffstat (limited to 'ui/gfx')
-rw-r--r--ui/gfx/transform_unittest.cc43
-rw-r--r--ui/gfx/transform_util.cc15
2 files changed, 1 insertions, 57 deletions
diff --git a/ui/gfx/transform_unittest.cc b/ui/gfx/transform_unittest.cc
index 7d4d8ad..1944142 100644
--- a/ui/gfx/transform_unittest.cc
+++ b/ui/gfx/transform_unittest.cc
@@ -735,49 +735,6 @@ TEST(XFormTest, BlendRotate) {
}
}
-#if defined(_WIN64)
-// http://crbug.com/406574
-#define MAYBE_BlendRotateFollowsShortestPath DISABLED_BlendRotateFollowsShortestPath
-#else
-#define MAYBE_BlendRotateFollowsShortestPath BlendRotateFollowsShortestPath
-#endif
-TEST(XFormTest, MAYBE_BlendRotateFollowsShortestPath) {
- // Verify that we interpolate along the shortest path regardless of whether
- // this path crosses the 180-degree point.
- Vector3dF axes[] = {
- Vector3dF(1, 0, 0),
- Vector3dF(0, 1, 0),
- Vector3dF(0, 0, 1),
- Vector3dF(1, 1, 1)
- };
- for (size_t index = 0; index < arraysize(axes); ++index) {
- for (int i = -5; i < 15; ++i) {
- Transform from1;
- from1.RotateAbout(axes[index], 130.0);
- Transform to1;
- to1.RotateAbout(axes[index], 175.0);
-
- Transform from2;
- from2.RotateAbout(axes[index], 140.0);
- Transform to2;
- to2.RotateAbout(axes[index], 185.0);
-
- double t = i / 9.0;
- EXPECT_TRUE(to1.Blend(from1, t));
- EXPECT_TRUE(to2.Blend(from2, t));
-
- Transform expected1;
- expected1.RotateAbout(axes[index], 130.0 + 45.0 * t);
-
- Transform expected2;
- expected2.RotateAbout(axes[index], 140.0 + 45.0 * t);
-
- EXPECT_TRUE(MatricesAreNearlyEqual(expected1, to1));
- EXPECT_TRUE(MatricesAreNearlyEqual(expected2, to2));
- }
- }
-}
-
TEST(XFormTest, CanBlend180DegreeRotation) {
Vector3dF axes[] = {
Vector3dF(1, 0, 0),
diff --git a/ui/gfx/transform_util.cc b/ui/gfx/transform_util.cc
index 5c9fb50..3eab6e2 100644
--- a/ui/gfx/transform_util.cc
+++ b/ui/gfx/transform_util.cc
@@ -66,19 +66,6 @@ bool Slerp(SkMScalar out[4],
// Clamp product to -1.0 <= product <= 1.0.
product = std::min(std::max(product, -1.0), 1.0);
- // Interpolate angles along the shortest path. For example, to interpolate
- // between a 175 degree angle and a 185 degree angle, interpolate along the
- // 10 degree path from 175 to 185, rather than along the 350 degree path in
- // the opposite direction. This matches WebKit's implementation but not
- // the current W3C spec. Fixing the spec to match this approach is discussed
- // at:
- // http://lists.w3.org/Archives/Public/www-style/2013May/0131.html
- double scale1 = 1.0;
- if (product < 0) {
- product = -product;
- scale1 = -1.0;
- }
-
const double epsilon = 1e-5;
if (std::abs(product - 1.0) < epsilon) {
for (int i = 0; i < 4; ++i)
@@ -90,7 +77,7 @@ bool Slerp(SkMScalar out[4],
double theta = std::acos(product);
double w = std::sin(progress * theta) * (1.0 / denom);
- scale1 *= std::cos(progress * theta) - product * w;
+ double scale1 = std::cos(progress * theta) - product * w;
double scale2 = w;
Combine<4>(out, q1, q2, scale1, scale2);