| 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 2697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2708 : ScrollbarLayerImpl(id) | 2708 : ScrollbarLayerImpl(id) |
| 2709 { | 2709 { |
| 2710 } | 2710 } |
| 2711 }; | 2711 }; |
| 2712 | 2712 |
| 2713 static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvid
er* provider) | 2713 static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvid
er* provider) |
| 2714 { | 2714 { |
| 2715 ResourceProvider::ResourceId resourceId = provider->createResource(0, gfx::S
ize(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny); | 2715 ResourceProvider::ResourceId resourceId = provider->createResource(0, gfx::S
ize(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny); |
| 2716 | 2716 |
| 2717 scoped_ptr<TestRenderPass> pass = TestRenderPass::create(RenderPass::Id(1, 1
), gfx::Rect(0, 0, 1, 1), WebTransformationMatrix()); | 2717 scoped_ptr<TestRenderPass> pass = TestRenderPass::create(RenderPass::Id(1, 1
), gfx::Rect(0, 0, 1, 1), WebTransformationMatrix()); |
| 2718 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::create(WebTransfo
rmationMatrix(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), 1); | 2718 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::Create(); |
| 2719 sharedState->SetAll(WebTransformationMatrix(), gfx::Rect(0, 0, 1, 1), gfx::R
ect(0, 0, 1, 1), 1); |
| 2719 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); | 2720 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
| 2720 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); | 2721 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); |
| 2721 | 2722 |
| 2722 pass->appendSharedQuadState(sharedState.Pass()); | 2723 pass->appendSharedQuadState(sharedState.Pass()); |
| 2723 pass->appendQuad(quad.PassAs<DrawQuad>()); | 2724 pass->appendQuad(quad.PassAs<DrawQuad>()); |
| 2724 | 2725 |
| 2725 return pass.PassAs<RenderPass>(); | 2726 return pass.PassAs<RenderPass>(); |
| 2726 } | 2727 } |
| 2727 | 2728 |
| 2728 TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) | 2729 TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) |
| (...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4182 LayerTreeSettings m_settings; | 4183 LayerTreeSettings m_settings; |
| 4183 gfx::Size m_viewportSize; | 4184 gfx::Size m_viewportSize; |
| 4184 base::hash_set<RenderPass::Id> m_textures; | 4185 base::hash_set<RenderPass::Id> m_textures; |
| 4185 }; | 4186 }; |
| 4186 | 4187 |
| 4187 static void configureRenderPassTestData(const char* testScript, RenderPassRemova
lTestData& testData, TestRenderer* renderer) | 4188 static void configureRenderPassTestData(const char* testScript, RenderPassRemova
lTestData& testData, TestRenderer* renderer) |
| 4188 { | 4189 { |
| 4189 renderer->clearCachedTextures(); | 4190 renderer->clearCachedTextures(); |
| 4190 | 4191 |
| 4191 // One shared state for all quads - we don't need the correct details | 4192 // One shared state for all quads - we don't need the correct details |
| 4192 testData.sharedQuadState = SharedQuadState::create(WebTransformationMatrix()
, gfx::Rect(), gfx::Rect(), 1.0); | 4193 testData.sharedQuadState = SharedQuadState::Create(); |
| 4194 testData.sharedQuadState->SetAll(WebTransformationMatrix(), gfx::Rect(), gfx
::Rect(), 1.0); |
| 4193 | 4195 |
| 4194 const char* currentChar = testScript; | 4196 const char* currentChar = testScript; |
| 4195 | 4197 |
| 4196 // Pre-create root pass | 4198 // Pre-create root pass |
| 4197 RenderPass::Id rootRenderPassId = RenderPass::Id(testScript[0], testScript[1
]); | 4199 RenderPass::Id rootRenderPassId = RenderPass::Id(testScript[0], testScript[1
]); |
| 4198 testData.renderPassCache.add(rootRenderPassId, TestRenderPass::create(rootRe
nderPassId, gfx::Rect(), WebTransformationMatrix())); | 4200 testData.renderPassCache.add(rootRenderPassId, TestRenderPass::create(rootRe
nderPassId, gfx::Rect(), WebTransformationMatrix())); |
| 4199 while (*currentChar) { | 4201 while (*currentChar) { |
| 4200 int layerId = *currentChar; | 4202 int layerId = *currentChar; |
| 4201 currentChar++; | 4203 currentChar++; |
| 4202 ASSERT_TRUE(currentChar); | 4204 ASSERT_TRUE(currentChar); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4473 testCaseIndex++; | 4475 testCaseIndex++; |
| 4474 } | 4476 } |
| 4475 } | 4477 } |
| 4476 | 4478 |
| 4477 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4479 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
| 4478 LayerTreeHostImplTest, | 4480 LayerTreeHostImplTest, |
| 4479 ::testing::Values(false, true)); | 4481 ::testing::Values(false, true)); |
| 4480 | 4482 |
| 4481 } // namespace | 4483 } // namespace |
| 4482 } // namespace cc | 4484 } // namespace cc |
| OLD | NEW |