diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-26 18:08:38 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-26 18:08:38 +0000 |
commit | 056e814596e9a6b36d9665daace3411436f06795 (patch) | |
tree | bffd9371d94d9855bf31353053e7fed11474de75 /cc/test | |
parent | 39a7337981191d10da0843b0e33c65797f51fca5 (diff) | |
download | chromium_src-056e814596e9a6b36d9665daace3411436f06795.zip chromium_src-056e814596e9a6b36d9665daace3411436f06795.tar.gz chromium_src-056e814596e9a6b36d9665daace3411436f06795.tar.bz2 |
cc: Add shared quad states correctly in unit tests.
When we add quads for tests we must do so in a valid way. We were
adding quads for the same SharedQuadState with quads for a different
SharedQuadState in between, but that's totally uncool.
Add a third SharedQuadState so that quads refer to SharedQuadStates
in a contiguous way as we would like in reality.
R=piman
BUG=263069
Review URL: https://codereview.chromium.org/24596005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225505 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/render_pass_test_common.cc | 16 | ||||
-rw-r--r-- | cc/test/render_pass_test_common.h | 10 |
2 files changed, 15 insertions, 11 deletions
diff --git a/cc/test/render_pass_test_common.cc b/cc/test/render_pass_test_common.cc index b02e5bb..35bc561 100644 --- a/cc/test/render_pass_test_common.cc +++ b/cc/test/render_pass_test_common.cc @@ -29,7 +29,8 @@ void TestRenderPass::AppendSharedQuadState( } void TestRenderPass::AppendOneOfEveryQuadType( - cc::ResourceProvider* resource_provider, RenderPass::Id child_pass) { + ResourceProvider* resource_provider, + RenderPass::Id child_pass) { gfx::Rect rect(0, 0, 100, 100); gfx::Rect opaque_rect(10, 10, 80, 80); const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; @@ -202,9 +203,11 @@ void TestRenderPass::AppendOneOfEveryQuadType( false); AppendQuad(transformed_tile_quad.PassAs<DrawQuad>()); - scoped_ptr<cc::TileDrawQuad> tile_quad = - cc::TileDrawQuad::Create(); - tile_quad->SetNew(shared_state.get(), + scoped_ptr<cc::SharedQuadState> shared_state2 = cc::SharedQuadState::Create(); + shared_state->SetAll(gfx::Transform(), rect.size(), rect, rect, false, 1); + + scoped_ptr<cc::TileDrawQuad> tile_quad = cc::TileDrawQuad::Create(); + tile_quad->SetNew(shared_state2.get(), rect, opaque_rect, resource4, @@ -225,7 +228,7 @@ void TestRenderPass::AppendOneOfEveryQuadType( } scoped_ptr<cc::YUVVideoDrawQuad> yuv_quad = cc::YUVVideoDrawQuad::Create(); - yuv_quad->SetNew(shared_state.get(), + yuv_quad->SetNew(shared_state2.get(), rect, opaque_rect, gfx::Size(100, 100), @@ -235,8 +238,9 @@ void TestRenderPass::AppendOneOfEveryQuadType( plane_resources[3]); AppendQuad(yuv_quad.PassAs<DrawQuad>()); - AppendSharedQuadState(transformed_state.Pass()); AppendSharedQuadState(shared_state.Pass()); + AppendSharedQuadState(transformed_state.Pass()); + AppendSharedQuadState(shared_state2.Pass()); } } // namespace cc diff --git a/cc/test/render_pass_test_common.h b/cc/test/render_pass_test_common.h index 3180750..651278f 100644 --- a/cc/test/render_pass_test_common.h +++ b/cc/test/render_pass_test_common.h @@ -13,17 +13,17 @@ class ResourceProvider; namespace cc { -class TestRenderPass : public cc::RenderPass { +class TestRenderPass : public RenderPass { public: static scoped_ptr<TestRenderPass> Create() { return make_scoped_ptr(new TestRenderPass); } - void AppendQuad(scoped_ptr<cc::DrawQuad> quad); - void AppendSharedQuadState(scoped_ptr<cc::SharedQuadState> state); + void AppendQuad(scoped_ptr<DrawQuad> quad); + void AppendSharedQuadState(scoped_ptr<SharedQuadState> state); - void AppendOneOfEveryQuadType( - cc::ResourceProvider*, RenderPass::Id child_pass); + void AppendOneOfEveryQuadType(ResourceProvider* resource_provider, + RenderPass::Id child_pass); protected: TestRenderPass() : RenderPass() {} |