| 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 2677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2688 : ScrollbarLayerImpl(id) | 2688 : ScrollbarLayerImpl(id) |
| 2689 { | 2689 { |
| 2690 } | 2690 } |
| 2691 }; | 2691 }; |
| 2692 | 2692 |
| 2693 static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvid
er* provider) | 2693 static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvid
er* provider) |
| 2694 { | 2694 { |
| 2695 ResourceProvider::ResourceId resourceId = provider->createResource(0, gfx::S
ize(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny); | 2695 ResourceProvider::ResourceId resourceId = provider->createResource(0, gfx::S
ize(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny); |
| 2696 | 2696 |
| 2697 scoped_ptr<TestRenderPass> pass = TestRenderPass::create(RenderPass::Id(1, 1
), gfx::Rect(0, 0, 1, 1), WebTransformationMatrix()); | 2697 scoped_ptr<TestRenderPass> pass = TestRenderPass::create(RenderPass::Id(1, 1
), gfx::Rect(0, 0, 1, 1), WebTransformationMatrix()); |
| 2698 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::create(WebTransfo
rmationMatrix(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), 1); | 2698 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::Create(); |
| 2699 sharedState->SetAll(WebTransformationMatrix(), gfx::Rect(0, 0, 1, 1), gfx::R
ect(0, 0, 1, 1), 1); |
| 2699 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); | 2700 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
| 2700 quad->SetNew(sharedState.get(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1)
, resourceId, false, gfx::RectF(0, 0, 1, 1), false); | 2701 quad->SetNew(sharedState.get(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1)
, resourceId, false, gfx::RectF(0, 0, 1, 1), false); |
| 2701 | 2702 |
| 2702 pass->appendSharedQuadState(sharedState.Pass()); | 2703 pass->appendSharedQuadState(sharedState.Pass()); |
| 2703 pass->appendQuad(quad.PassAs<DrawQuad>()); | 2704 pass->appendQuad(quad.PassAs<DrawQuad>()); |
| 2704 | 2705 |
| 2705 return pass.PassAs<RenderPass>(); | 2706 return pass.PassAs<RenderPass>(); |
| 2706 } | 2707 } |
| 2707 | 2708 |
| 2708 TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) | 2709 TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) |
| (...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4162 LayerTreeSettings m_settings; | 4163 LayerTreeSettings m_settings; |
| 4163 gfx::Size m_viewportSize; | 4164 gfx::Size m_viewportSize; |
| 4164 base::hash_set<RenderPass::Id> m_textures; | 4165 base::hash_set<RenderPass::Id> m_textures; |
| 4165 }; | 4166 }; |
| 4166 | 4167 |
| 4167 static void configureRenderPassTestData(const char* testScript, RenderPassRemova
lTestData& testData, TestRenderer* renderer) | 4168 static void configureRenderPassTestData(const char* testScript, RenderPassRemova
lTestData& testData, TestRenderer* renderer) |
| 4168 { | 4169 { |
| 4169 renderer->clearCachedTextures(); | 4170 renderer->clearCachedTextures(); |
| 4170 | 4171 |
| 4171 // One shared state for all quads - we don't need the correct details | 4172 // One shared state for all quads - we don't need the correct details |
| 4172 testData.sharedQuadState = SharedQuadState::create(WebTransformationMatrix()
, gfx::Rect(), gfx::Rect(), 1.0); | 4173 testData.sharedQuadState = SharedQuadState::Create(); |
| 4174 testData.sharedQuadState->SetAll(WebTransformationMatrix(), gfx::Rect(), gfx
::Rect(), 1.0); |
| 4173 | 4175 |
| 4174 const char* currentChar = testScript; | 4176 const char* currentChar = testScript; |
| 4175 | 4177 |
| 4176 // Pre-create root pass | 4178 // Pre-create root pass |
| 4177 RenderPass::Id rootRenderPassId = RenderPass::Id(testScript[0], testScript[1
]); | 4179 RenderPass::Id rootRenderPassId = RenderPass::Id(testScript[0], testScript[1
]); |
| 4178 testData.renderPassCache.add(rootRenderPassId, TestRenderPass::create(rootRe
nderPassId, gfx::Rect(), WebTransformationMatrix())); | 4180 testData.renderPassCache.add(rootRenderPassId, TestRenderPass::create(rootRe
nderPassId, gfx::Rect(), WebTransformationMatrix())); |
| 4179 while (*currentChar) { | 4181 while (*currentChar) { |
| 4180 int layerId = *currentChar; | 4182 int layerId = *currentChar; |
| 4181 currentChar++; | 4183 currentChar++; |
| 4182 ASSERT_TRUE(currentChar); | 4184 ASSERT_TRUE(currentChar); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4453 testCaseIndex++; | 4455 testCaseIndex++; |
| 4454 } | 4456 } |
| 4455 } | 4457 } |
| 4456 | 4458 |
| 4457 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4459 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
| 4458 LayerTreeHostImplTest, | 4460 LayerTreeHostImplTest, |
| 4459 ::testing::Values(false, true)); | 4461 ::testing::Values(false, true)); |
| 4460 | 4462 |
| 4461 } // namespace | 4463 } // namespace |
| 4462 } // namespace cc | 4464 } // namespace cc |
| OLD | NEW |