summaryrefslogtreecommitdiffstats
path: root/cc/base
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-23 17:15:38 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-23 17:15:38 +0000
commit7852a5066d2b6c1d552cb40cd918a39b1eee4de0 (patch)
tree62956fb9cbef939657a49c709ccfdc3877e1926b /cc/base
parent9c01c3700505881089954e65a3fed60d1b85b5fd (diff)
downloadchromium_src-7852a5066d2b6c1d552cb40cd918a39b1eee4de0.zip
chromium_src-7852a5066d2b6c1d552cb40cd918a39b1eee4de0.tar.gz
chromium_src-7852a5066d2b6c1d552cb40cd918a39b1eee4de0.tar.bz2
Revert 224725 "Fix compilation and ui_unittests with float trans..."
Reverting as caused perf regression because of new static initializers. > Fix compilation and ui_unittests with float transforms > > This change also cleans up the use of gfx::Transform::get/setDouble > (in favor of get/set) at callsites to prepare for changing SkMScalar > from double to float. > > BUG=269817 > > Review URL: https://chromiumcodereview.appspot.com/23811009 TBR=enne@chromium.org Review URL: https://codereview.chromium.org/23537065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/base')
-rw-r--r--cc/base/float_quad_unittest.cc38
-rw-r--r--cc/base/math_util.cc12
-rw-r--r--cc/base/math_util.h8
-rw-r--r--cc/base/math_util_unittest.cc2
4 files changed, 30 insertions, 30 deletions
diff --git a/cc/base/float_quad_unittest.cc b/cc/base/float_quad_unittest.cc
index c2186fd81..186624e 100644
--- a/cc/base/float_quad_unittest.cc
+++ b/cc/base/float_quad_unittest.cc
@@ -15,15 +15,15 @@ namespace {
TEST(FloatQuadTest, IsRectilinearTest) {
const int kNumRectilinear = 8;
gfx::Transform rectilinear_trans[kNumRectilinear];
- rectilinear_trans[1].Rotate(90.f);
- rectilinear_trans[2].Rotate(180.f);
- rectilinear_trans[3].Rotate(270.f);
- rectilinear_trans[4].SkewX(0.00000000001f);
- rectilinear_trans[5].SkewY(0.00000000001f);
- rectilinear_trans[6].Scale(0.00001f, 0.00001f);
- rectilinear_trans[6].Rotate(180.f);
- rectilinear_trans[7].Scale(100000.f, 100000.f);
- rectilinear_trans[7].Rotate(180.f);
+ rectilinear_trans[1].Rotate(90.0);
+ rectilinear_trans[2].Rotate(180.0);
+ rectilinear_trans[3].Rotate(270.0);
+ rectilinear_trans[4].SkewX(0.00000000001);
+ rectilinear_trans[5].SkewY(0.00000000001);
+ rectilinear_trans[6].Scale(0.00001, 0.00001);
+ rectilinear_trans[6].Rotate(180.0);
+ rectilinear_trans[7].Scale(100000, 100000);
+ rectilinear_trans[7].Rotate(180.0);
gfx::QuadF original(
gfx::RectF(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f));
@@ -38,16 +38,16 @@ TEST(FloatQuadTest, IsRectilinearTest) {
const int kNumNonRectilinear = 10;
gfx::Transform non_rectilinear_trans[kNumNonRectilinear];
- non_rectilinear_trans[0].Rotate(359.9999f);
- non_rectilinear_trans[1].Rotate(0.0000001f);
- non_rectilinear_trans[2].Rotate(89.9999f);
- non_rectilinear_trans[3].Rotate(90.00001f);
- non_rectilinear_trans[4].Rotate(179.9999f);
- non_rectilinear_trans[5].Rotate(180.00001f);
- non_rectilinear_trans[6].Rotate(269.9999f);
- non_rectilinear_trans[7].Rotate(270.0001f);
- non_rectilinear_trans[8].SkewX(0.00001f);
- non_rectilinear_trans[9].SkewY(0.00001f);
+ non_rectilinear_trans[0].Rotate(359.999);
+ non_rectilinear_trans[1].Rotate(0.0000001);
+ non_rectilinear_trans[2].Rotate(89.999999);
+ non_rectilinear_trans[3].Rotate(90.0000001);
+ non_rectilinear_trans[4].Rotate(179.999999);
+ non_rectilinear_trans[5].Rotate(180.0000001);
+ non_rectilinear_trans[6].Rotate(269.999999);
+ non_rectilinear_trans[7].Rotate(270.0000001);
+ non_rectilinear_trans[8].SkewX(0.00001);
+ non_rectilinear_trans[9].SkewY(0.00001);
for (int i = 0; i < kNumNonRectilinear; ++i) {
bool clipped = false;
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc
index 764c461..40b8d11 100644
--- a/cc/base/math_util.cc
+++ b/cc/base/math_util.cc
@@ -72,13 +72,13 @@ static HomogeneousCoordinate ComputeClippedPointForEdge(
// w plane when this is called.
DCHECK(h1.ShouldBeClipped() ^ h2.ShouldBeClipped());
- // ...or any positive non-zero small epsilon
- double w = 0.00001;
- double t = (w - h1.w()) / (h2.w() - h1.w());
+ SkMScalar w = 0.00001; // or any positive non-zero small epsilon
- SkMScalar x = SkDoubleToMScalar((1.0 - t) * h1.x() + t * h2.x());
- SkMScalar y = SkDoubleToMScalar((1.0 - t) * h1.y() + t * h2.y());
- SkMScalar z = SkDoubleToMScalar((1.0 - t) * h1.z() + t * h2.z());
+ SkMScalar t = (w - h1.w()) / (h2.w() - h1.w());
+
+ SkMScalar x = (1 - t) * h1.x() + t * h2.x();
+ SkMScalar y = (1 - t) * h1.y() + t * h2.y();
+ SkMScalar z = (1 - t) * h1.z() + t * h2.z();
return HomogeneousCoordinate(x, y, z, w);
}
diff --git a/cc/base/math_util.h b/cc/base/math_util.h
index 67a9370..7912f8a 100644
--- a/cc/base/math_util.h
+++ b/cc/base/math_util.h
@@ -39,24 +39,24 @@ struct HomogeneousCoordinate {
bool ShouldBeClipped() const { return w() <= 0.0; }
gfx::PointF CartesianPoint2d() const {
- if (w() == SK_MScalar1)
+ if (w() == 1.0)
return gfx::PointF(x(), y());
// For now, because this code is used privately only by MathUtil, it should
// never be called when w == 0, and we do not yet need to handle that case.
DCHECK(w());
- SkMScalar inv_w = SK_MScalar1 / w();
+ SkMScalar inv_w = 1.0 / w();
return gfx::PointF(x() * inv_w, y() * inv_w);
}
gfx::Point3F CartesianPoint3d() const {
- if (w() == SK_MScalar1)
+ if (w() == 1)
return gfx::Point3F(x(), y(), z());
// For now, because this code is used privately only by MathUtil, it should
// never be called when w == 0, and we do not yet need to handle that case.
DCHECK(w());
- SkMScalar inv_w = SK_MScalar1 / w();
+ SkMScalar inv_w = 1.0 / w();
return gfx::Point3F(x() * inv_w, y() * inv_w, z() * inv_w);
}
diff --git a/cc/base/math_util_unittest.cc b/cc/base/math_util_unittest.cc
index 5bcf2ee..d62280d 100644
--- a/cc/base/math_util_unittest.cc
+++ b/cc/base/math_util_unittest.cc
@@ -22,7 +22,7 @@ TEST(MathUtilTest, ProjectionOfPerpendicularPlane) {
gfx::Transform transform;
transform.MakeIdentity();
- transform.matrix().set(2, 2, 0);
+ transform.matrix().setDouble(2, 2, 0);
gfx::RectF rect = gfx::RectF(0, 0, 1, 1);
gfx::RectF projected_rect = MathUtil::ProjectClippedRect(transform, rect);