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_tree_host_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLa
yer()); | 1066 DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLa
yer()); |
1067 root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl->activeTree()
, 2, false, false, true, m_hostImpl->resourceProvider())); | 1067 root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl->activeTree()
, 2, false, false, true, m_hostImpl->resourceProvider())); |
1068 | 1068 |
1069 LayerTreeHostImpl::FrameData frame; | 1069 LayerTreeHostImpl::FrameData frame; |
1070 | 1070 |
1071 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 1071 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
1072 m_hostImpl->drawLayers(frame); | 1072 m_hostImpl->drawLayers(frame); |
1073 m_hostImpl->didDrawAllLayers(frame); | 1073 m_hostImpl->didDrawAllLayers(frame); |
1074 | 1074 |
1075 // When a texture is missing and we're not animating, we draw as usual with
checkerboarding. | 1075 // When a texture is missing and we're not animating, we draw as usual with
checkerboarding. |
1076 m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(),
1)); | 1076 m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(),
3)); |
1077 root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); | 1077 root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
1078 root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl->activeTree()
, 2, true, false, false, m_hostImpl->resourceProvider())); | 1078 root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl->activeTree()
, 4, true, false, false, m_hostImpl->resourceProvider())); |
1079 | 1079 |
1080 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 1080 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
1081 m_hostImpl->drawLayers(frame); | 1081 m_hostImpl->drawLayers(frame); |
1082 m_hostImpl->didDrawAllLayers(frame); | 1082 m_hostImpl->didDrawAllLayers(frame); |
1083 | 1083 |
1084 // When a texture is missing and we're animating, we don't want to draw anyt
hing. | 1084 // When a texture is missing and we're animating, we don't want to draw anyt
hing. |
1085 m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(),
1)); | 1085 m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(),
5)); |
1086 root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); | 1086 root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
1087 root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl->activeTree()
, 2, true, false, true, m_hostImpl->resourceProvider())); | 1087 root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl->activeTree()
, 6, true, false, true, m_hostImpl->resourceProvider())); |
1088 | 1088 |
1089 EXPECT_FALSE(m_hostImpl->prepareToDraw(frame)); | 1089 EXPECT_FALSE(m_hostImpl->prepareToDraw(frame)); |
1090 m_hostImpl->drawLayers(frame); | 1090 m_hostImpl->drawLayers(frame); |
1091 m_hostImpl->didDrawAllLayers(frame); | 1091 m_hostImpl->didDrawAllLayers(frame); |
1092 | 1092 |
1093 // When the layer skips draw and we're animating, we still draw the frame. | 1093 // When the layer skips draw and we're animating, we still draw the frame. |
1094 m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(),
1)); | 1094 m_hostImpl->setRootLayer(DidDrawCheckLayer::create(m_hostImpl->activeTree(),
7)); |
1095 root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); | 1095 root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); |
1096 root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl->activeTree()
, 2, false, true, true, m_hostImpl->resourceProvider())); | 1096 root->addChild(MissingTextureAnimatingLayer::create(m_hostImpl->activeTree()
, 8, false, true, true, m_hostImpl->resourceProvider())); |
1097 | 1097 |
1098 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 1098 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
1099 m_hostImpl->drawLayers(frame); | 1099 m_hostImpl->drawLayers(frame); |
1100 m_hostImpl->didDrawAllLayers(frame); | 1100 m_hostImpl->didDrawAllLayers(frame); |
1101 } | 1101 } |
1102 | 1102 |
1103 TEST_P(LayerTreeHostImplTest, scrollRootIgnored) | 1103 TEST_P(LayerTreeHostImplTest, scrollRootIgnored) |
1104 { | 1104 { |
1105 scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); | 1105 scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); |
1106 root->setScrollable(false); | 1106 root->setScrollable(false); |
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2472 } | 2472 } |
2473 | 2473 |
2474 bool m_didLoseOutputSurfaceCalled; | 2474 bool m_didLoseOutputSurfaceCalled; |
2475 }; | 2475 }; |
2476 | 2476 |
2477 TEST_P(LayerTreeHostImplTest, outputSurfaceLostAndRestoredNotificationSentToAllL
ayers) | 2477 TEST_P(LayerTreeHostImplTest, outputSurfaceLostAndRestoredNotificationSentToAllL
ayers) |
2478 { | 2478 { |
2479 m_hostImpl->setRootLayer(OutputSurfaceLostNotificationCheckLayer::create(m_h
ostImpl->activeTree(), 1)); | 2479 m_hostImpl->setRootLayer(OutputSurfaceLostNotificationCheckLayer::create(m_h
ostImpl->activeTree(), 1)); |
2480 OutputSurfaceLostNotificationCheckLayer* root = static_cast<OutputSurfaceLos
tNotificationCheckLayer*>(m_hostImpl->rootLayer()); | 2480 OutputSurfaceLostNotificationCheckLayer* root = static_cast<OutputSurfaceLos
tNotificationCheckLayer*>(m_hostImpl->rootLayer()); |
2481 | 2481 |
2482 root->addChild(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl->a
ctiveTree(), 1)); | 2482 root->addChild(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl->a
ctiveTree(), 2)); |
2483 OutputSurfaceLostNotificationCheckLayer* layer1 = static_cast<OutputSurfaceL
ostNotificationCheckLayer*>(root->children()[0]); | 2483 OutputSurfaceLostNotificationCheckLayer* layer1 = static_cast<OutputSurfaceL
ostNotificationCheckLayer*>(root->children()[0]); |
2484 | 2484 |
2485 layer1->addChild(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl-
>activeTree(), 2)); | 2485 layer1->addChild(OutputSurfaceLostNotificationCheckLayer::create(m_hostImpl-
>activeTree(), 3)); |
2486 OutputSurfaceLostNotificationCheckLayer* layer2 = static_cast<OutputSurfaceL
ostNotificationCheckLayer*>(layer1->children()[0]); | 2486 OutputSurfaceLostNotificationCheckLayer* layer2 = static_cast<OutputSurfaceL
ostNotificationCheckLayer*>(layer1->children()[0]); |
2487 | 2487 |
2488 EXPECT_FALSE(root->didLoseOutputSurfaceCalled()); | 2488 EXPECT_FALSE(root->didLoseOutputSurfaceCalled()); |
2489 EXPECT_FALSE(layer1->didLoseOutputSurfaceCalled()); | 2489 EXPECT_FALSE(layer1->didLoseOutputSurfaceCalled()); |
2490 EXPECT_FALSE(layer2->didLoseOutputSurfaceCalled()); | 2490 EXPECT_FALSE(layer2->didLoseOutputSurfaceCalled()); |
2491 | 2491 |
2492 m_hostImpl->initializeRenderer(createOutputSurface()); | 2492 m_hostImpl->initializeRenderer(createOutputSurface()); |
2493 | 2493 |
2494 EXPECT_TRUE(root->didLoseOutputSurfaceCalled()); | 2494 EXPECT_TRUE(root->didLoseOutputSurfaceCalled()); |
2495 EXPECT_TRUE(layer1->didLoseOutputSurfaceCalled()); | 2495 EXPECT_TRUE(layer1->didLoseOutputSurfaceCalled()); |
(...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4928 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); | 4928 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); |
4929 drawFrameAndTestDamage(noDamage); | 4929 drawFrameAndTestDamage(noDamage); |
4930 } | 4930 } |
4931 | 4931 |
4932 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4932 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4933 LayerTreeHostImplTest, | 4933 LayerTreeHostImplTest, |
4934 ::testing::Values(false, true)); | 4934 ::testing::Values(false, true)); |
4935 | 4935 |
4936 } // namespace | 4936 } // namespace |
4937 } // namespace cc | 4937 } // namespace cc |
OLD | NEW |