Chromium Code Reviews| 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/trees/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
| 6 | 6 |
| 7 #include "cc/animation/layer_animation_controller.h" | 7 #include "cc/animation/layer_animation_controller.h" |
| 8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
| 9 #include "cc/layers/content_layer.h" | 9 #include "cc/layers/content_layer.h" |
| 10 #include "cc/layers/content_layer_client.h" | 10 #include "cc/layers/content_layer_client.h" |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 gfx::PointF(0.5f, 0.f), | 387 gfx::PointF(0.5f, 0.f), |
| 388 gfx::PointF(0.f, 1.2f), | 388 gfx::PointF(0.f, 1.2f), |
| 389 gfx::Size(10, 12), | 389 gfx::Size(10, 12), |
| 390 false); | 390 false); |
| 391 ExecuteCalculateDrawProperties(root.get()); | 391 ExecuteCalculateDrawProperties(root.get()); |
| 392 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, layer->draw_transform()); | 392 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, layer->draw_transform()); |
| 393 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, | 393 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, |
| 394 layer->screen_space_transform()); | 394 layer->screen_space_transform()); |
| 395 } | 395 } |
| 396 | 396 |
| 397 TEST(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { | 397 TEST(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { |
|
danakj
2013/07/08 21:53:42
Maybe this should be named DoesNotTransformAbountS
enne (OOO)
2013/07/08 22:03:46
Only the inputs to this test have changed, in para
danakj
2013/07/09 01:52:45
Mmm.. right, the scroll offset/delta are still use
| |
| 398 const gfx::Vector2d kScrollOffset(50, 100); | 398 const gfx::Vector2d kScrollOffset(50, 100); |
| 399 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f); | 399 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f); |
| 400 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(), | 400 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(), |
| 401 -kScrollOffset.y()); | 401 -kScrollOffset.y()); |
| 402 const float kPageScale = 0.888f; | 402 const float kPageScale = 0.888f; |
| 403 const float kDeviceScale = 1.666f; | 403 const float kDeviceScale = 1.666f; |
| 404 | 404 |
| 405 FakeImplProxy proxy; | 405 FakeImplProxy proxy; |
| 406 FakeLayerTreeHostImpl host_impl(&proxy); | 406 FakeLayerTreeHostImpl host_impl(&proxy); |
| 407 | 407 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 419 gfx::Size(500, 500), | 419 gfx::Size(500, 500), |
| 420 false); | 420 false); |
| 421 | 421 |
| 422 scoped_ptr<LayerImpl> scroll_layerScopedPtr( | 422 scoped_ptr<LayerImpl> scroll_layerScopedPtr( |
| 423 LayerImpl::Create(host_impl.active_tree(), 2)); | 423 LayerImpl::Create(host_impl.active_tree(), 2)); |
| 424 LayerImpl* scroll_layer = scroll_layerScopedPtr.get(); | 424 LayerImpl* scroll_layer = scroll_layerScopedPtr.get(); |
| 425 SetLayerPropertiesForTesting(scroll_layer, | 425 SetLayerPropertiesForTesting(scroll_layer, |
| 426 identity_matrix, | 426 identity_matrix, |
| 427 identity_matrix, | 427 identity_matrix, |
| 428 gfx::PointF(), | 428 gfx::PointF(), |
| 429 kScrollLayerPosition, | 429 gfx::PointF(), |
| 430 gfx::Size(10, 20), | 430 gfx::Size(10, 20), |
| 431 false); | 431 false); |
| 432 scroll_layer->SetScrollable(true); | 432 scroll_layer->SetScrollable(true); |
| 433 scroll_layer->SetScrollOffset(kScrollOffset); | 433 scroll_layer->SetScrollOffset(kScrollOffset); |
| 434 scroll_layer->SetScrollDelta(kScrollDelta); | 434 scroll_layer->SetScrollDelta(kScrollDelta); |
| 435 gfx::Transform impl_transform; | 435 gfx::Transform impl_transform; |
| 436 scroll_layer->AddChild(sublayer_scoped_ptr.Pass()); | 436 scroll_layer->AddChild(sublayer_scoped_ptr.Pass()); |
| 437 | 437 |
| 438 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); | 438 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); |
| 439 SetLayerPropertiesForTesting(root.get(), | 439 SetLayerPropertiesForTesting(root.get(), |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 458 sublayer->screen_space_transform()); | 458 sublayer->screen_space_transform()); |
| 459 | 459 |
| 460 gfx::Transform arbitrary_translate; | 460 gfx::Transform arbitrary_translate; |
| 461 const float kTranslateX = 10.6f; | 461 const float kTranslateX = 10.6f; |
| 462 const float kTranslateY = 20.6f; | 462 const float kTranslateY = 20.6f; |
| 463 arbitrary_translate.Translate(kTranslateX, kTranslateY); | 463 arbitrary_translate.Translate(kTranslateX, kTranslateY); |
| 464 SetLayerPropertiesForTesting(scroll_layer, | 464 SetLayerPropertiesForTesting(scroll_layer, |
| 465 arbitrary_translate, | 465 arbitrary_translate, |
| 466 identity_matrix, | 466 identity_matrix, |
| 467 gfx::PointF(), | 467 gfx::PointF(), |
| 468 kScrollLayerPosition, | 468 gfx::PointF(), |
| 469 gfx::Size(10, 20), | 469 gfx::Size(10, 20), |
| 470 false); | 470 false); |
| 471 ExecuteCalculateDrawProperties( | 471 ExecuteCalculateDrawProperties( |
| 472 root.get(), kDeviceScale, kPageScale, scroll_layer); | 472 root.get(), kDeviceScale, kPageScale, scroll_layer); |
| 473 expected_transform.MakeIdentity(); | 473 expected_transform.MakeIdentity(); |
| 474 expected_transform.Translate( | 474 expected_transform.Translate( |
| 475 MathUtil::Round(kTranslateX * kPageScale * kDeviceScale + | 475 MathUtil::Round(kTranslateX * kPageScale * kDeviceScale + |
| 476 sub_layer_screen_position.x()), | 476 sub_layer_screen_position.x()), |
| 477 MathUtil::Round(kTranslateY * kPageScale * kDeviceScale + | 477 MathUtil::Round(kTranslateY * kPageScale * kDeviceScale + |
| 478 sub_layer_screen_position.y())); | 478 sub_layer_screen_position.y())); |
| (...skipping 7852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8331 EXPECT_EQ(root->id(), render_surface_layer_list[0]->id()); | 8331 EXPECT_EQ(root->id(), render_surface_layer_list[0]->id()); |
| 8332 | 8332 |
| 8333 // The root render surface should only have 1 contributing layer, since the | 8333 // The root render surface should only have 1 contributing layer, since the |
| 8334 // other layers are empty/clipped away. | 8334 // other layers are empty/clipped away. |
| 8335 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); | 8335 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); |
| 8336 EXPECT_EQ(root->id(), root->render_surface()->layer_list()[0]->id()); | 8336 EXPECT_EQ(root->id(), root->render_surface()->layer_list()[0]->id()); |
| 8337 } | 8337 } |
| 8338 | 8338 |
| 8339 } // namespace | 8339 } // namespace |
| 8340 } // namespace cc | 8340 } // namespace cc |
| OLD | NEW |