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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 LayerImpl::Create(host_impl_->pending_tree(), 2)); | 1310 LayerImpl::Create(host_impl_->pending_tree(), 2)); |
1311 LayerImpl* child = root->test_properties()->children[0]; | 1311 LayerImpl* child = root->test_properties()->children[0]; |
1312 child->SetBounds(gfx::Size(10, 10)); | 1312 child->SetBounds(gfx::Size(10, 10)); |
1313 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); | 1313 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); |
1314 child->SetDrawsContent(true); | 1314 child->SetDrawsContent(true); |
1315 | 1315 |
1316 host_impl_->pending_tree()->SetElementIdsForTesting(); | 1316 host_impl_->pending_tree()->SetElementIdsForTesting(); |
1317 | 1317 |
1318 AddAnimatedTransformToElementWithPlayer(child->element_id(), timeline(), 10.0, | 1318 AddAnimatedTransformToElementWithPlayer(child->element_id(), timeline(), 10.0, |
1319 3, 0); | 1319 3, 0); |
| 1320 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); |
1320 | 1321 |
1321 EXPECT_FALSE(did_request_next_frame_); | 1322 EXPECT_FALSE(did_request_next_frame_); |
1322 EXPECT_FALSE(did_request_redraw_); | 1323 EXPECT_FALSE(did_request_redraw_); |
1323 EXPECT_FALSE(did_request_commit_); | 1324 EXPECT_FALSE(did_request_commit_); |
1324 | 1325 |
1325 host_impl_->AnimatePendingTreeAfterCommit(); | 1326 host_impl_->AnimatePendingTreeAfterCommit(); |
1326 | 1327 |
1327 // An animation exists on the pending layer. Doing | 1328 // An animation exists on the pending layer. Doing |
1328 // AnimatePendingTreeAfterCommit() requests another frame. | 1329 // AnimatePendingTreeAfterCommit() requests another frame. |
1329 // In reality, animations without has_set_start_time() == true do not need to | 1330 // In reality, animations without has_set_start_time() == true do not need to |
(...skipping 30 matching lines...) Expand all Loading... |
1360 LayerImpl* root = *host_impl_->active_tree()->begin(); | 1361 LayerImpl* root = *host_impl_->active_tree()->begin(); |
1361 root->SetBounds(gfx::Size(50, 50)); | 1362 root->SetBounds(gfx::Size(50, 50)); |
1362 root->test_properties()->force_render_surface = true; | 1363 root->test_properties()->force_render_surface = true; |
1363 | 1364 |
1364 root->test_properties()->AddChild( | 1365 root->test_properties()->AddChild( |
1365 LayerImpl::Create(host_impl_->active_tree(), 2)); | 1366 LayerImpl::Create(host_impl_->active_tree(), 2)); |
1366 LayerImpl* child = root->test_properties()->children[0]; | 1367 LayerImpl* child = root->test_properties()->children[0]; |
1367 child->SetBounds(gfx::Size(10, 10)); | 1368 child->SetBounds(gfx::Size(10, 10)); |
1368 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); | 1369 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); |
1369 child->SetDrawsContent(true); | 1370 child->SetDrawsContent(true); |
1370 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | |
1371 host_impl_->active_tree()->SetElementIdsForTesting(); | 1371 host_impl_->active_tree()->SetElementIdsForTesting(); |
1372 | 1372 |
1373 // Add a translate from 6,7 to 8,9. | 1373 // Add a translate from 6,7 to 8,9. |
1374 TransformOperations start; | 1374 TransformOperations start; |
1375 start.AppendTranslate(6.f, 7.f, 0.f); | 1375 start.AppendTranslate(6.f, 7.f, 0.f); |
1376 TransformOperations end; | 1376 TransformOperations end; |
1377 end.AppendTranslate(8.f, 9.f, 0.f); | 1377 end.AppendTranslate(8.f, 9.f, 0.f); |
1378 AddAnimatedTransformToElementWithPlayer(child->element_id(), timeline(), 4.0, | 1378 AddAnimatedTransformToElementWithPlayer(child->element_id(), timeline(), 4.0, |
1379 start, end); | 1379 start, end); |
| 1380 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
1380 | 1381 |
1381 base::TimeTicks now = base::TimeTicks::Now(); | 1382 base::TimeTicks now = base::TimeTicks::Now(); |
1382 host_impl_->WillBeginImplFrame( | 1383 host_impl_->WillBeginImplFrame( |
1383 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now)); | 1384 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now)); |
1384 | 1385 |
1385 // TODO(crbug.com/551134): We always request a new frame and a draw for | 1386 // TODO(crbug.com/551134): We always request a new frame and a draw for |
1386 // animations that are on the pending tree, but we don't need to do that | 1387 // animations that are on the pending tree, but we don't need to do that |
1387 // unless they are waiting for some future time to start. | 1388 // unless they are waiting for some future time to start. |
1388 EXPECT_TRUE(did_request_next_frame_); | 1389 EXPECT_TRUE(did_request_next_frame_); |
1389 EXPECT_TRUE(did_request_redraw_); | 1390 EXPECT_TRUE(did_request_redraw_); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 LayerImpl* root = *host_impl_->active_tree()->begin(); | 1473 LayerImpl* root = *host_impl_->active_tree()->begin(); |
1473 root->SetBounds(gfx::Size(50, 50)); | 1474 root->SetBounds(gfx::Size(50, 50)); |
1474 | 1475 |
1475 root->test_properties()->AddChild( | 1476 root->test_properties()->AddChild( |
1476 LayerImpl::Create(host_impl_->active_tree(), 2)); | 1477 LayerImpl::Create(host_impl_->active_tree(), 2)); |
1477 LayerImpl* child = root->test_properties()->children[0]; | 1478 LayerImpl* child = root->test_properties()->children[0]; |
1478 child->SetBounds(gfx::Size(10, 10)); | 1479 child->SetBounds(gfx::Size(10, 10)); |
1479 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); | 1480 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); |
1480 child->SetDrawsContent(true); | 1481 child->SetDrawsContent(true); |
1481 | 1482 |
1482 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | |
1483 host_impl_->active_tree()->SetElementIdsForTesting(); | 1483 host_impl_->active_tree()->SetElementIdsForTesting(); |
1484 | 1484 |
1485 // Add a translate animation. | 1485 // Add a translate animation. |
1486 TransformOperations start; | 1486 TransformOperations start; |
1487 start.AppendTranslate(6.f, 7.f, 0.f); | 1487 start.AppendTranslate(6.f, 7.f, 0.f); |
1488 TransformOperations end; | 1488 TransformOperations end; |
1489 end.AppendTranslate(8.f, 9.f, 0.f); | 1489 end.AppendTranslate(8.f, 9.f, 0.f); |
1490 AddAnimatedTransformToElementWithPlayer(child->element_id(), timeline(), 4.0, | 1490 AddAnimatedTransformToElementWithPlayer(child->element_id(), timeline(), 4.0, |
1491 start, end); | 1491 start, end); |
| 1492 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
1492 | 1493 |
1493 base::TimeTicks now = base::TimeTicks::Now(); | 1494 base::TimeTicks now = base::TimeTicks::Now(); |
1494 host_impl_->WillBeginImplFrame( | 1495 host_impl_->WillBeginImplFrame( |
1495 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now)); | 1496 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now)); |
1496 EXPECT_TRUE(did_request_next_frame_); | 1497 EXPECT_TRUE(did_request_next_frame_); |
1497 did_request_next_frame_ = false; | 1498 did_request_next_frame_ = false; |
1498 | 1499 |
1499 host_impl_->ActivateAnimations(); | 1500 host_impl_->ActivateAnimations(); |
1500 // On activating an animation, we should request another frame so that we'll | 1501 // On activating an animation, we should request another frame so that we'll |
1501 // continue ticking the animation. | 1502 // continue ticking the animation. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 root->SetBounds(gfx::Size(50, 50)); | 1550 root->SetBounds(gfx::Size(50, 50)); |
1550 root->SetHasRenderSurface(true); | 1551 root->SetHasRenderSurface(true); |
1551 | 1552 |
1552 root->test_properties()->AddChild(std::unique_ptr<MissingTilesLayer>( | 1553 root->test_properties()->AddChild(std::unique_ptr<MissingTilesLayer>( |
1553 new MissingTilesLayer(host_impl_->active_tree(), 2))); | 1554 new MissingTilesLayer(host_impl_->active_tree(), 2))); |
1554 MissingTilesLayer* child = | 1555 MissingTilesLayer* child = |
1555 static_cast<MissingTilesLayer*>(root->test_properties()->children[0]); | 1556 static_cast<MissingTilesLayer*>(root->test_properties()->children[0]); |
1556 child->SetBounds(gfx::Size(10, 10)); | 1557 child->SetBounds(gfx::Size(10, 10)); |
1557 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); | 1558 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); |
1558 child->SetDrawsContent(true); | 1559 child->SetDrawsContent(true); |
1559 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | |
1560 | 1560 |
1561 host_impl_->active_tree()->SetElementIdsForTesting(); | 1561 host_impl_->active_tree()->SetElementIdsForTesting(); |
1562 | 1562 |
1563 EXPECT_TRUE(child->was_ever_ready_since_last_transform_animation()); | 1563 EXPECT_TRUE(child->was_ever_ready_since_last_transform_animation()); |
1564 | 1564 |
1565 // Add a translate from 6,7 to 8,9. | 1565 // Add a translate from 6,7 to 8,9. |
1566 TransformOperations start; | 1566 TransformOperations start; |
1567 start.AppendTranslate(6.f, 7.f, 0.f); | 1567 start.AppendTranslate(6.f, 7.f, 0.f); |
1568 TransformOperations end; | 1568 TransformOperations end; |
1569 end.AppendTranslate(8.f, 9.f, 0.f); | 1569 end.AppendTranslate(8.f, 9.f, 0.f); |
1570 int animation_id = AddAnimatedTransformToElementWithPlayer( | 1570 int animation_id = AddAnimatedTransformToElementWithPlayer( |
1571 child->element_id(), timeline(), 4.0, start, end); | 1571 child->element_id(), timeline(), 4.0, start, end); |
| 1572 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
1572 | 1573 |
1573 base::TimeTicks now = base::TimeTicks::Now(); | 1574 base::TimeTicks now = base::TimeTicks::Now(); |
1574 host_impl_->WillBeginImplFrame( | 1575 host_impl_->WillBeginImplFrame( |
1575 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now)); | 1576 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now)); |
1576 | 1577 |
1577 host_impl_->ActivateAnimations(); | 1578 host_impl_->ActivateAnimations(); |
1578 host_impl_->Animate(); | 1579 host_impl_->Animate(); |
1579 | 1580 |
1580 EXPECT_FALSE(child->was_ever_ready_since_last_transform_animation()); | 1581 EXPECT_FALSE(child->was_ever_ready_since_last_transform_animation()); |
1581 | 1582 |
(...skipping 9667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11249 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); | 11250 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); |
11250 | 11251 |
11251 // Re-initialize with a software output surface. | 11252 // Re-initialize with a software output surface. |
11252 output_surface_ = FakeOutputSurface::CreateDelegatingSoftware(); | 11253 output_surface_ = FakeOutputSurface::CreateDelegatingSoftware(); |
11253 host_impl_->InitializeRenderer(output_surface_.get()); | 11254 host_impl_->InitializeRenderer(output_surface_.get()); |
11254 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); | 11255 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); |
11255 } | 11256 } |
11256 | 11257 |
11257 } // namespace | 11258 } // namespace |
11258 } // namespace cc | 11259 } // namespace cc |
OLD | NEW |