diff options
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/mock_quad_culler.cc | 24 | ||||
-rw-r--r-- | cc/test/mock_quad_culler.h | 20 | ||||
-rw-r--r-- | cc/test/render_pass_test_utils.cc | 27 |
3 files changed, 28 insertions, 43 deletions
diff --git a/cc/test/mock_quad_culler.cc b/cc/test/mock_quad_culler.cc index 773430f..ddb5913 100644 --- a/cc/test/mock_quad_culler.cc +++ b/cc/test/mock_quad_culler.cc @@ -9,23 +9,19 @@ namespace cc { -MockQuadCuller::MockQuadCuller() - : active_quad_list_(&quad_list_storage_), - active_shared_quad_state_list_(&shared_quad_state_storage_) {} +MockQuadCuller::MockQuadCuller() { + render_pass_storage_ = RenderPass::Create(); + active_render_pass_ = render_pass_storage_.get(); +} -MockQuadCuller::MockQuadCuller( - QuadList* external_quad_list, - SharedQuadStateList* external_shared_quad_state_list) - : active_quad_list_(external_quad_list), - active_shared_quad_state_list_(external_shared_quad_state_list) {} +MockQuadCuller::MockQuadCuller(RenderPass* external_render_pass) + : active_render_pass_(external_render_pass) { +} MockQuadCuller::~MockQuadCuller() {} -SharedQuadState* MockQuadCuller::UseSharedQuadState( - scoped_ptr<SharedQuadState> shared_quad_state) { - SharedQuadState* raw_ptr = shared_quad_state.get(); - active_shared_quad_state_list_->push_back(shared_quad_state.Pass()); - return raw_ptr; +SharedQuadState* MockQuadCuller::CreateSharedQuadState() { + return active_render_pass_->CreateAndAppendSharedQuadState(); } gfx::Rect MockQuadCuller::UnoccludedContentRect( @@ -63,7 +59,7 @@ gfx::Rect MockQuadCuller::UnoccludedContributingSurfaceContentRect( void MockQuadCuller::Append(scoped_ptr<DrawQuad> draw_quad) { DCHECK(!draw_quad->rect.IsEmpty()); DCHECK(!draw_quad->visible_rect.IsEmpty()); - active_quad_list_->push_back(draw_quad.Pass()); + active_render_pass_->quad_list.push_back(draw_quad.Pass()); } } // namespace cc diff --git a/cc/test/mock_quad_culler.h b/cc/test/mock_quad_culler.h index 6e3436a..195eb5b 100644 --- a/cc/test/mock_quad_culler.h +++ b/cc/test/mock_quad_culler.h @@ -17,12 +17,10 @@ class MockQuadCuller : public QuadSink { MockQuadCuller(); virtual ~MockQuadCuller(); - MockQuadCuller(QuadList* external_quad_list, - SharedQuadStateList* external_shared_quad_state_list); + explicit MockQuadCuller(RenderPass* external_render_pass); // QuadSink interface. - virtual SharedQuadState* UseSharedQuadState( - scoped_ptr<SharedQuadState> shared_quad_state) OVERRIDE; + virtual SharedQuadState* CreateSharedQuadState() OVERRIDE; virtual gfx::Rect UnoccludedContentRect(const gfx::Rect& content_rect, const gfx::Transform& draw_transform) OVERRIDE; @@ -31,9 +29,9 @@ class MockQuadCuller : public QuadSink { const gfx::Transform& draw_transform) OVERRIDE; virtual void Append(scoped_ptr<DrawQuad> draw_quad) OVERRIDE; - const QuadList& quad_list() const { return *active_quad_list_; } + const QuadList& quad_list() const { return active_render_pass_->quad_list; } const SharedQuadStateList& shared_quad_state_list() const { - return *active_shared_quad_state_list_; + return active_render_pass_->shared_quad_state_list; } void set_occluded_target_rect(const gfx::Rect& occluded) { @@ -46,15 +44,13 @@ class MockQuadCuller : public QuadSink { } void clear_lists() { - active_quad_list_->clear(); - active_shared_quad_state_list_->clear(); + active_render_pass_->quad_list.clear(); + active_render_pass_->shared_quad_state_list.clear(); } private: - QuadList* active_quad_list_; - QuadList quad_list_storage_; - SharedQuadStateList* active_shared_quad_state_list_; - SharedQuadStateList shared_quad_state_storage_; + scoped_ptr<RenderPass> render_pass_storage_; + RenderPass* active_render_pass_; gfx::Rect occluded_target_rect_; gfx::Rect occluded_target_rect_for_contributing_surface_; }; diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc index 8d0d955..e70919a 100644 --- a/cc/test/render_pass_test_utils.cc +++ b/cc/test/render_pass_test_utils.cc @@ -31,9 +31,8 @@ TestRenderPass* AddRenderPass(RenderPassList* pass_list, SolidColorDrawQuad* AddQuad(TestRenderPass* pass, const gfx::Rect& rect, SkColor color) { - MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); - SharedQuadState* shared_state = - quad_sink.UseSharedQuadState(SharedQuadState::Create()); + MockQuadCuller quad_sink(pass); + SharedQuadState* shared_state = quad_sink.CreateSharedQuadState(); shared_state->SetAll(gfx::Transform(), rect.size(), rect, @@ -51,9 +50,8 @@ SolidColorDrawQuad* AddQuad(TestRenderPass* pass, SolidColorDrawQuad* AddClippedQuad(TestRenderPass* pass, const gfx::Rect& rect, SkColor color) { - MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); - SharedQuadState* shared_state = - quad_sink.UseSharedQuadState(SharedQuadState::Create()); + MockQuadCuller quad_sink(pass); + SharedQuadState* shared_state = quad_sink.CreateSharedQuadState(); shared_state->SetAll(gfx::Transform(), rect.size(), rect, @@ -72,9 +70,8 @@ SolidColorDrawQuad* AddTransformedQuad(TestRenderPass* pass, const gfx::Rect& rect, SkColor color, const gfx::Transform& transform) { - MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); - SharedQuadState* shared_state = - quad_sink.UseSharedQuadState(SharedQuadState::Create()); + MockQuadCuller quad_sink(pass); + SharedQuadState* shared_state = quad_sink.CreateSharedQuadState(); shared_state->SetAll( transform, rect.size(), rect, rect, false, 1, SkXfermode::kSrcOver_Mode); scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); @@ -86,11 +83,9 @@ SolidColorDrawQuad* AddTransformedQuad(TestRenderPass* pass, void AddRenderPassQuad(TestRenderPass* to_pass, TestRenderPass* contributing_pass) { - MockQuadCuller quad_sink(&to_pass->quad_list, - &to_pass->shared_quad_state_list); + MockQuadCuller quad_sink(to_pass); gfx::Rect output_rect = contributing_pass->output_rect; - SharedQuadState* shared_state = - quad_sink.UseSharedQuadState(SharedQuadState::Create()); + SharedQuadState* shared_state = quad_sink.CreateSharedQuadState(); shared_state->SetAll(gfx::Transform(), output_rect.size(), output_rect, @@ -117,11 +112,9 @@ void AddRenderPassQuad(TestRenderPass* to_pass, ResourceProvider::ResourceId mask_resource_id, const FilterOperations& filters, gfx::Transform transform) { - MockQuadCuller quad_sink(&to_pass->quad_list, - &to_pass->shared_quad_state_list); + MockQuadCuller quad_sink(to_pass); gfx::Rect output_rect = contributing_pass->output_rect; - SharedQuadState* shared_state = - quad_sink.UseSharedQuadState(SharedQuadState::Create()); + SharedQuadState* shared_state = quad_sink.CreateSharedQuadState(); shared_state->SetAll(transform, output_rect.size(), output_rect, |