Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11416088: cc: Turn SharedQuadState into a struct-like class similar to DrawQuads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix debug build Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/quad_culler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/quad_culler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698