| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/layer_sorter.h" | 7 #include "cc/layer_sorter.h" |
| 8 | 8 |
| 9 #include "cc/layer_impl.h" | 9 #include "cc/layer_impl.h" |
| 10 #include "cc/math_util.h" | 10 #include "cc/math_util.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // not clipped, its bounds will actually incorrectly appear much smaller and
the | 171 // not clipped, its bounds will actually incorrectly appear much smaller and
the |
| 172 // correct sorting dependency will not be found. | 172 // correct sorting dependency will not be found. |
| 173 WebTransformationMatrix transformB; | 173 WebTransformationMatrix transformB; |
| 174 transformB.translate3d(0, 0, 0.7); | 174 transformB.translate3d(0, 0, 0.7); |
| 175 transformB.rotate3d(0, 45, 0); | 175 transformB.rotate3d(0, 45, 0); |
| 176 transformB.translate(-5, -5); | 176 transformB.translate(-5, -5); |
| 177 LayerShape layerB(10, 10, perspectiveMatrix * transformB); | 177 LayerShape layerB(10, 10, perspectiveMatrix * transformB); |
| 178 | 178 |
| 179 // Sanity check that the test case actually covers the intended scenario, wh
ere part | 179 // Sanity check that the test case actually covers the intended scenario, wh
ere part |
| 180 // of layer B go behind the w = 0 plane. | 180 // of layer B go behind the w = 0 plane. |
| 181 FloatQuad testQuad = FloatQuad(FloatRect(FloatPoint(-0.5, -0.5), FloatSize(1
, 1))); | 181 FloatQuad testQuad = FloatQuad(gfx::RectF(-0.5, -0.5, 1, 1)); |
| 182 bool clipped = false; | 182 bool clipped = false; |
| 183 MathUtil::mapQuad(perspectiveMatrix * transformB, testQuad, clipped); | 183 MathUtil::mapQuad(perspectiveMatrix * transformB, testQuad, clipped); |
| 184 ASSERT_TRUE(clipped); | 184 ASSERT_TRUE(clipped); |
| 185 | 185 |
| 186 overlapResult = LayerSorter::checkOverlap(&layerA, &layerB, zThreshold, weig
ht); | 186 overlapResult = LayerSorter::checkOverlap(&layerA, &layerB, zThreshold, weig
ht); |
| 187 EXPECT_EQ(LayerSorter::ABeforeB, overlapResult); | 187 EXPECT_EQ(LayerSorter::ABeforeB, overlapResult); |
| 188 } | 188 } |
| 189 | 189 |
| 190 TEST(LayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) | 190 TEST(LayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) |
| 191 { | 191 { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 256 |
| 257 ASSERT_EQ(static_cast<size_t>(5), layerList.size()); | 257 ASSERT_EQ(static_cast<size_t>(5), layerList.size()); |
| 258 EXPECT_EQ(3, layerList[0]->id()); | 258 EXPECT_EQ(3, layerList[0]->id()); |
| 259 EXPECT_EQ(4, layerList[1]->id()); | 259 EXPECT_EQ(4, layerList[1]->id()); |
| 260 EXPECT_EQ(1, layerList[2]->id()); | 260 EXPECT_EQ(1, layerList[2]->id()); |
| 261 EXPECT_EQ(2, layerList[3]->id()); | 261 EXPECT_EQ(2, layerList[3]->id()); |
| 262 EXPECT_EQ(5, layerList[4]->id()); | 262 EXPECT_EQ(5, layerList[4]->id()); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace | 265 } // namespace |
| OLD | NEW |