From 3b85fd90f30a8abef2a9c2a7a93cee208c2801a9 Mon Sep 17 00:00:00 2001 From: "weiliangc@chromium.org" Date: Thu, 10 Jul 2014 00:00:02 +0000 Subject: Use RenderPass to create DrawQuad in unittests Instead of calling DQ::Create() function and then push it into RenderPass in unittest, use RenderPass's function call to create and append a DQ while only pass out a raw pointer instead of ownership. Follow CL 369623002. BUG=344962 TEST=cc_unittests, content_unittests Review URL: https://codereview.chromium.org/368403003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282179 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/test/render_pass_test_common.cc | 57 +++++++++++++++----------------------- 1 file changed, 23 insertions(+), 34 deletions(-) (limited to 'cc/test/render_pass_test_common.cc') diff --git a/cc/test/render_pass_test_common.cc b/cc/test/render_pass_test_common.cc index 9cbb987..98d085c 100644 --- a/cc/test/render_pass_test_common.cc +++ b/cc/test/render_pass_test_common.cc @@ -19,10 +19,6 @@ namespace cc { -void TestRenderPass::AppendQuad(scoped_ptr quad) { - quad_list.push_back(quad.Pass()); -} - void TestRenderPass::AppendOneOfEveryQuadType( ResourceProvider* resource_provider, RenderPass::Id child_pass) { @@ -83,17 +79,16 @@ void TestRenderPass::AppendOneOfEveryQuadType( SkXfermode::kSrcOver_Mode, 0); - scoped_ptr checkerboard_quad = - CheckerboardDrawQuad::Create(); + CheckerboardDrawQuad* checkerboard_quad = + this->CreateAndAppendDrawQuad(); checkerboard_quad->SetNew(shared_state, rect, visible_rect, SK_ColorRED); - AppendQuad(checkerboard_quad.PassAs()); - scoped_ptr debug_border_quad = - DebugBorderDrawQuad::Create(); + DebugBorderDrawQuad* debug_border_quad = + this->CreateAndAppendDrawQuad(); debug_border_quad->SetNew(shared_state, rect, visible_rect, SK_ColorRED, 1); - AppendQuad(debug_border_quad.PassAs()); - scoped_ptr io_surface_quad = IOSurfaceDrawQuad::Create(); + IOSurfaceDrawQuad* io_surface_quad = + this->CreateAndAppendDrawQuad(); io_surface_quad->SetNew(shared_state, rect, opaque_rect, @@ -101,11 +96,10 @@ void TestRenderPass::AppendOneOfEveryQuadType( gfx::Size(50, 50), resource7, IOSurfaceDrawQuad::FLIPPED); - AppendQuad(io_surface_quad.PassAs()); if (child_pass.layer_id) { - scoped_ptr render_pass_quad = - RenderPassDrawQuad::Create(); + RenderPassDrawQuad* render_pass_quad = + this->CreateAndAppendDrawQuad(); render_pass_quad->SetNew(shared_state, rect, visible_rect, @@ -116,10 +110,9 @@ void TestRenderPass::AppendOneOfEveryQuadType( gfx::RectF(), FilterOperations(), FilterOperations()); - AppendQuad(render_pass_quad.PassAs()); - scoped_ptr render_pass_replica_quad = - RenderPassDrawQuad::Create(); + RenderPassDrawQuad* render_pass_replica_quad = + this->CreateAndAppendDrawQuad(); render_pass_replica_quad->SetNew(shared_state, rect, visible_rect, @@ -130,26 +123,24 @@ void TestRenderPass::AppendOneOfEveryQuadType( gfx::RectF(), FilterOperations(), FilterOperations()); - AppendQuad(render_pass_replica_quad.PassAs()); } - scoped_ptr solid_color_quad = - SolidColorDrawQuad::Create(); + SolidColorDrawQuad* solid_color_quad = + this->CreateAndAppendDrawQuad(); solid_color_quad->SetNew( shared_state, rect, visible_rect, SK_ColorRED, false); - AppendQuad(solid_color_quad.PassAs()); - scoped_ptr stream_video_quad = - StreamVideoDrawQuad::Create(); + StreamVideoDrawQuad* stream_video_quad = + this->CreateAndAppendDrawQuad(); stream_video_quad->SetNew(shared_state, rect, opaque_rect, visible_rect, resource6, gfx::Transform()); - AppendQuad(stream_video_quad.PassAs()); - scoped_ptr texture_quad = TextureDrawQuad::Create(); + TextureDrawQuad* texture_quad = + this->CreateAndAppendDrawQuad(); texture_quad->SetNew(shared_state, rect, opaque_rect, @@ -161,9 +152,9 @@ void TestRenderPass::AppendOneOfEveryQuadType( SK_ColorTRANSPARENT, vertex_opacity, false); - AppendQuad(texture_quad.PassAs()); - scoped_ptr scaled_tile_quad = TileDrawQuad::Create(); + TileDrawQuad* scaled_tile_quad = + this->CreateAndAppendDrawQuad(); scaled_tile_quad->SetNew(shared_state, rect, opaque_rect, @@ -172,7 +163,6 @@ void TestRenderPass::AppendOneOfEveryQuadType( gfx::RectF(0, 0, 50, 50), gfx::Size(50, 50), false); - AppendQuad(scaled_tile_quad.PassAs()); SharedQuadState* transformed_state = this->CreateAndAppendSharedQuadState(); transformed_state->CopyFrom(shared_state); @@ -180,7 +170,8 @@ void TestRenderPass::AppendOneOfEveryQuadType( rotation.Rotate(45); transformed_state->content_to_target_transform = transformed_state->content_to_target_transform * rotation; - scoped_ptr transformed_tile_quad = TileDrawQuad::Create(); + TileDrawQuad* transformed_tile_quad = + this->CreateAndAppendDrawQuad(); transformed_tile_quad->SetNew(transformed_state, rect, opaque_rect, @@ -189,7 +180,6 @@ void TestRenderPass::AppendOneOfEveryQuadType( gfx::RectF(0, 0, 100, 100), gfx::Size(100, 100), false); - AppendQuad(transformed_tile_quad.PassAs()); SharedQuadState* shared_state2 = this->CreateAndAppendSharedQuadState(); shared_state->SetAll(gfx::Transform(), @@ -201,7 +191,7 @@ void TestRenderPass::AppendOneOfEveryQuadType( SkXfermode::kSrcOver_Mode, 0); - scoped_ptr tile_quad = TileDrawQuad::Create(); + TileDrawQuad* tile_quad = this->CreateAndAppendDrawQuad(); tile_quad->SetNew(shared_state2, rect, opaque_rect, @@ -210,7 +200,6 @@ void TestRenderPass::AppendOneOfEveryQuadType( gfx::RectF(0, 0, 100, 100), gfx::Size(100, 100), false); - AppendQuad(tile_quad.PassAs()); ResourceProvider::ResourceId plane_resources[4]; for (int i = 0; i < 4; ++i) { @@ -223,7 +212,8 @@ void TestRenderPass::AppendOneOfEveryQuadType( resource_provider->AllocateForTesting(plane_resources[i]); } YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601; - scoped_ptr yuv_quad = YUVVideoDrawQuad::Create(); + YUVVideoDrawQuad* yuv_quad = + this->CreateAndAppendDrawQuad(); yuv_quad->SetNew(shared_state2, rect, opaque_rect, @@ -234,7 +224,6 @@ void TestRenderPass::AppendOneOfEveryQuadType( plane_resources[2], plane_resources[3], color_space); - AppendQuad(yuv_quad.PassAs()); } } // namespace cc -- cgit v1.1