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(); | 2717 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); |
2718 pass->SetNew(RenderPass::Id(1, 1), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1,
1), WebTransformationMatrix()); | 2718 pass->SetNew(RenderPass::Id(1, 1), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1,
1), WebTransformationMatrix(), NULL); |
2719 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::Create(); | 2719 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::Create(); |
2720 sharedState->SetAll(WebTransformationMatrix(), gfx::Rect(0, 0, 1, 1), gfx::R
ect(0, 0, 1, 1), 1); | 2720 sharedState->SetAll(WebTransformationMatrix(), gfx::Rect(0, 0, 1, 1), gfx::R
ect(0, 0, 1, 1), 1); |
2721 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); | 2721 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
2722 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); | 2722 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); |
2723 | 2723 |
2724 pass->AppendSharedQuadState(sharedState.Pass()); | 2724 pass->AppendSharedQuadState(sharedState.Pass()); |
2725 pass->AppendQuad(quad.PassAs<DrawQuad>()); | 2725 pass->AppendQuad(quad.PassAs<DrawQuad>()); |
2726 | 2726 |
2727 return pass.PassAs<RenderPass>(); | 2727 return pass.PassAs<RenderPass>(); |
2728 } | 2728 } |
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4192 | 4192 |
4193 // One shared state for all quads - we don't need the correct details | 4193 // One shared state for all quads - we don't need the correct details |
4194 testData.sharedQuadState = SharedQuadState::Create(); | 4194 testData.sharedQuadState = SharedQuadState::Create(); |
4195 testData.sharedQuadState->SetAll(WebTransformationMatrix(), gfx::Rect(), gfx
::Rect(), 1.0); | 4195 testData.sharedQuadState->SetAll(WebTransformationMatrix(), gfx::Rect(), gfx
::Rect(), 1.0); |
4196 | 4196 |
4197 const char* currentChar = testScript; | 4197 const char* currentChar = testScript; |
4198 | 4198 |
4199 // Pre-create root pass | 4199 // Pre-create root pass |
4200 RenderPass::Id rootRenderPassId = RenderPass::Id(testScript[0], testScript[1
]); | 4200 RenderPass::Id rootRenderPassId = RenderPass::Id(testScript[0], testScript[1
]); |
4201 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); | 4201 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); |
4202 pass->SetNew(rootRenderPassId, gfx::Rect(), gfx::Rect(), WebTransformationMa
trix()); | 4202 pass->SetNew(rootRenderPassId, gfx::Rect(), gfx::Rect(), WebTransformationMa
trix(), NULL); |
4203 testData.renderPassCache.add(rootRenderPassId, pass.Pass()); | 4203 testData.renderPassCache.add(rootRenderPassId, pass.Pass()); |
4204 while (*currentChar) { | 4204 while (*currentChar) { |
4205 int layerId = *currentChar; | 4205 int layerId = *currentChar; |
4206 currentChar++; | 4206 currentChar++; |
4207 ASSERT_TRUE(currentChar); | 4207 ASSERT_TRUE(currentChar); |
4208 int index = *currentChar; | 4208 int index = *currentChar; |
4209 currentChar++; | 4209 currentChar++; |
4210 | 4210 |
4211 RenderPass::Id renderPassId = RenderPass::Id(layerId, index); | 4211 RenderPass::Id renderPassId = RenderPass::Id(layerId, index); |
4212 | 4212 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4252 } | 4252 } |
4253 if (*currentChar == ']') | 4253 if (*currentChar == ']') |
4254 currentChar++; | 4254 currentChar++; |
4255 } | 4255 } |
4256 | 4256 |
4257 if (testData.renderPassCache.find(newRenderPassId) == testData.r
enderPassCache.end()) { | 4257 if (testData.renderPassCache.find(newRenderPassId) == testData.r
enderPassCache.end()) { |
4258 if (hasTexture) | 4258 if (hasTexture) |
4259 renderer->setHaveCachedResourcesForRenderPassId(newRende
rPassId); | 4259 renderer->setHaveCachedResourcesForRenderPassId(newRende
rPassId); |
4260 | 4260 |
4261 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); | 4261 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); |
4262 pass->SetNew(newRenderPassId, gfx::Rect(), gfx::Rect(), WebT
ransformationMatrix()); | 4262 pass->SetNew(newRenderPassId, gfx::Rect(), gfx::Rect(), WebT
ransformationMatrix(), NULL); |
4263 testData.renderPassCache.add(newRenderPassId, pass.Pass()); | 4263 testData.renderPassCache.add(newRenderPassId, pass.Pass()); |
4264 } | 4264 } |
4265 | 4265 |
4266 gfx::Rect quadRect = gfx::Rect(0, 0, 1, 1); | 4266 gfx::Rect quadRect = gfx::Rect(0, 0, 1, 1); |
4267 gfx::Rect contentsChangedRect = contentsChanged ? quadRect : gfx
::Rect(); | 4267 gfx::Rect contentsChangedRect = contentsChanged ? quadRect : gfx
::Rect(); |
4268 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create
(); | 4268 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create
(); |
4269 quad->SetNew(testData.sharedQuadState.get(), quadRect, newRender
PassId, isReplica, 1, contentsChangedRect, 1, 1, 0, 0); | 4269 quad->SetNew(testData.sharedQuadState.get(), quadRect, newRender
PassId, isReplica, 1, contentsChangedRect, 1, 1, 0, 0); |
4270 renderPass->AppendQuad(quad.PassAs<DrawQuad>()); | 4270 renderPass->AppendQuad(quad.PassAs<DrawQuad>()); |
4271 } | 4271 } |
4272 } | 4272 } |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4480 testCaseIndex++; | 4480 testCaseIndex++; |
4481 } | 4481 } |
4482 } | 4482 } |
4483 | 4483 |
4484 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4484 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4485 LayerTreeHostImplTest, | 4485 LayerTreeHostImplTest, |
4486 ::testing::Values(false, true)); | 4486 ::testing::Values(false, true)); |
4487 | 4487 |
4488 } // namespace | 4488 } // namespace |
4489 } // namespace cc | 4489 } // namespace cc |
OLD | NEW |