Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: cc/layer_sorter_unittest.cc

Issue 11774005: Migrate more functions from MathUtil to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: try to fix double/float conversion errors Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/gl_renderer.cc ('k') | cc/layer_tree_host_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layer_sorter.h" 5 #include "cc/layer_sorter.h"
6 6
7 #include "cc/layer_impl.h" 7 #include "cc/layer_impl.h"
8 #include "cc/math_util.h" 8 #include "cc/math_util.h"
9 #include "cc/single_thread_proxy.h" 9 #include "cc/single_thread_proxy.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 transformA.Translate3d(-15, 0, -2); 163 transformA.Translate3d(-15, 0, -2);
164 transformA.Translate(-5, -5); 164 transformA.Translate(-5, -5);
165 LayerShape layerA(10, 10, perspectiveMatrix * transformA); 165 LayerShape layerA(10, 10, perspectiveMatrix * transformA);
166 166
167 // With this sequence of transforms, when layer B is correctly clipped, it w ill be 167 // With this sequence of transforms, when layer B is correctly clipped, it w ill be
168 // visible on the left half of the projection plane, in front of layerA. Whe n it is 168 // visible on the left half of the projection plane, in front of layerA. Whe n it is
169 // not clipped, its bounds will actually incorrectly appear much smaller and the 169 // not clipped, its bounds will actually incorrectly appear much smaller and the
170 // correct sorting dependency will not be found. 170 // correct sorting dependency will not be found.
171 gfx::Transform transformB; 171 gfx::Transform transformB;
172 transformB.Translate3d(0, 0, 0.7); 172 transformB.Translate3d(0, 0, 0.7);
173 MathUtil::rotateEulerAngles(&transformB, 0, 45, 0); 173 transformB.RotateAboutYAxis(45);
174 transformB.Translate(-5, -5); 174 transformB.Translate(-5, -5);
175 LayerShape layerB(10, 10, perspectiveMatrix * transformB); 175 LayerShape layerB(10, 10, perspectiveMatrix * transformB);
176 176
177 // Sanity check that the test case actually covers the intended scenario, wh ere part 177 // Sanity check that the test case actually covers the intended scenario, wh ere part
178 // of layer B go behind the w = 0 plane. 178 // of layer B go behind the w = 0 plane.
179 gfx::QuadF testQuad = gfx::QuadF(gfx::RectF(-0.5, -0.5, 1, 1)); 179 gfx::QuadF testQuad = gfx::QuadF(gfx::RectF(-0.5, -0.5, 1, 1));
180 bool clipped = false; 180 bool clipped = false;
181 MathUtil::mapQuad(perspectiveMatrix * transformB, testQuad, clipped); 181 MathUtil::mapQuad(perspectiveMatrix * transformB, testQuad, clipped);
182 ASSERT_TRUE(clipped); 182 ASSERT_TRUE(clipped);
183 183
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 layerSorter.sort(layerList.begin(), layerList.end()); 308 layerSorter.sort(layerList.begin(), layerList.end());
309 309
310 ASSERT_EQ(static_cast<size_t>(2), layerList.size()); 310 ASSERT_EQ(static_cast<size_t>(2), layerList.size());
311 EXPECT_EQ(1, layerList[0]->id()); 311 EXPECT_EQ(1, layerList[0]->id());
312 EXPECT_EQ(2, layerList[1]->id()); 312 EXPECT_EQ(2, layerList[1]->id());
313 } 313 }
314 314
315 } // namespace 315 } // namespace
316 } // namespace cc 316 } // namespace cc
317 317
OLDNEW
« no previous file with comments | « cc/gl_renderer.cc ('k') | cc/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698