OLD | NEW |
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 Loading... |
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 ASSERT_EQ(static_cast<size_t>(5), layerList.size()); | 258 ASSERT_EQ(static_cast<size_t>(5), layerList.size()); |
259 EXPECT_EQ(3, layerList[0]->id()); | 259 EXPECT_EQ(3, layerList[0]->id()); |
260 EXPECT_EQ(4, layerList[1]->id()); | 260 EXPECT_EQ(4, layerList[1]->id()); |
261 EXPECT_EQ(1, layerList[2]->id()); | 261 EXPECT_EQ(1, layerList[2]->id()); |
262 EXPECT_EQ(2, layerList[3]->id()); | 262 EXPECT_EQ(2, layerList[3]->id()); |
263 EXPECT_EQ(5, layerList[4]->id()); | 263 EXPECT_EQ(5, layerList[4]->id()); |
264 } | 264 } |
265 | 265 |
266 } // namespace | 266 } // namespace |
267 } // namespace cc | 267 } // namespace cc |
OLD | NEW |