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

Side by Side Diff: cc/test/layer_test_common.cc

Issue 308193003: Removed QuadSink and MockQuadCuller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@plumLayerImpl
Patch Set: rm unused line Created 6 years, 6 months 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/test/layer_test_common.h" 5 #include "cc/test/layer_test_common.h"
6 6
7 #include "cc/base/math_util.h" 7 #include "cc/base/math_util.h"
8 #include "cc/base/region.h" 8 #include "cc/base/region.h"
9 #include "cc/layers/append_quads_data.h" 9 #include "cc/layers/append_quads_data.h"
10 #include "cc/quads/draw_quad.h" 10 #include "cc/quads/draw_quad.h"
11 #include "cc/quads/render_pass.h" 11 #include "cc/quads/render_pass.h"
12 #include "cc/test/fake_output_surface.h" 12 #include "cc/test/fake_output_surface.h"
13 #include "cc/test/mock_occlusion_tracker.h"
13 #include "cc/trees/layer_tree_host_common.h" 14 #include "cc/trees/layer_tree_host_common.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "ui/gfx/point_conversions.h" 16 #include "ui/gfx/point_conversions.h"
16 #include "ui/gfx/rect.h" 17 #include "ui/gfx/rect.h"
17 #include "ui/gfx/rect_conversions.h" 18 #include "ui/gfx/rect_conversions.h"
18 #include "ui/gfx/size_conversions.h" 19 #include "ui/gfx/size_conversions.h"
19 20
20 namespace cc { 21 namespace cc {
21 22
22 // Align with expected and actual output. 23 // Align with expected and actual output.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 EXPECT_NE(quad->rect.ToString(), quad->visible_rect.ToString()); 96 EXPECT_NE(quad->rect.ToString(), quad->visible_rect.ToString());
96 EXPECT_TRUE(quad->rect.Contains(quad->visible_rect)); 97 EXPECT_TRUE(quad->rect.Contains(quad->visible_rect));
97 ++(*partially_occluded_count); 98 ++(*partially_occluded_count);
98 } 99 }
99 } 100 }
100 } 101 }
101 102
102 LayerTestCommon::LayerImplTest::LayerImplTest() 103 LayerTestCommon::LayerImplTest::LayerImplTest()
103 : host_(FakeLayerTreeHost::Create()), 104 : host_(FakeLayerTreeHost::Create()),
104 root_layer_impl_(LayerImpl::Create(host_->host_impl()->active_tree(), 1)), 105 root_layer_impl_(LayerImpl::Create(host_->host_impl()->active_tree(), 1)),
105 render_pass_(RenderPass::Create()), 106 render_pass_(RenderPass::Create()) {
106 quad_culler_(make_scoped_ptr(
107 new MockQuadCuller(render_pass_.get(), &occlusion_tracker_))) {
108 scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); 107 scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d();
109 host_->host_impl()->InitializeRenderer( 108 host_->host_impl()->InitializeRenderer(
110 output_surface.PassAs<OutputSurface>()); 109 output_surface.PassAs<OutputSurface>());
111 } 110 }
112 111
113 LayerTestCommon::LayerImplTest::~LayerImplTest() {} 112 LayerTestCommon::LayerImplTest::~LayerImplTest() {}
114 113
115 void LayerTestCommon::LayerImplTest::CalcDrawProps( 114 void LayerTestCommon::LayerImplTest::CalcDrawProps(
116 const gfx::Size& viewport_size) { 115 const gfx::Size& viewport_size) {
117 LayerImplList layer_list; 116 LayerImplList layer_list;
118 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 117 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
119 root_layer_impl_.get(), viewport_size, &layer_list); 118 root_layer_impl_.get(), viewport_size, &layer_list);
120 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 119 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
121 } 120 }
122 121
123 void LayerTestCommon::LayerImplTest::AppendQuadsWithOcclusion( 122 void LayerTestCommon::LayerImplTest::AppendQuadsWithOcclusion(
124 LayerImpl* layer_impl, 123 LayerImpl* layer_impl,
125 const gfx::Rect& occluded) { 124 const gfx::Rect& occluded) {
126 AppendQuadsData data; 125 AppendQuadsData data;
127 126
128 quad_culler_->clear_lists(); 127 render_pass_->quad_list.clear();
129 quad_culler_->set_occluded_target_rect(occluded); 128 render_pass_->shared_quad_state_list.clear();
129 occlusion_tracker_.set_occluded_target_rect(occluded);
130 layer_impl->WillDraw(DRAW_MODE_HARDWARE, resource_provider()); 130 layer_impl->WillDraw(DRAW_MODE_HARDWARE, resource_provider());
131 layer_impl->AppendQuads(quad_culler_.get(), &data); 131 layer_impl->AppendQuads(render_pass_.get(), occlusion_tracker_, &data);
132 layer_impl->DidDraw(resource_provider()); 132 layer_impl->DidDraw(resource_provider());
133 } 133 }
134 134
135 void LayerTestCommon::LayerImplTest::AppendQuadsForPassWithOcclusion( 135 void LayerTestCommon::LayerImplTest::AppendQuadsForPassWithOcclusion(
136 LayerImpl* layer_impl, 136 LayerImpl* layer_impl,
137 const RenderPass::Id& id, 137 const RenderPass::Id& id,
138 const gfx::Rect& occluded) { 138 const gfx::Rect& occluded) {
139 AppendQuadsData data(id); 139 AppendQuadsData data(id);
140 140
141 quad_culler_->clear_lists(); 141 render_pass_->quad_list.clear();
142 quad_culler_->set_occluded_target_rect(occluded); 142 render_pass_->shared_quad_state_list.clear();
143 occlusion_tracker_.set_occluded_target_rect(occluded);
143 layer_impl->WillDraw(DRAW_MODE_HARDWARE, resource_provider()); 144 layer_impl->WillDraw(DRAW_MODE_HARDWARE, resource_provider());
144 layer_impl->AppendQuads(quad_culler_.get(), &data); 145 layer_impl->AppendQuads(render_pass_.get(), occlusion_tracker_, &data);
145 layer_impl->DidDraw(resource_provider()); 146 layer_impl->DidDraw(resource_provider());
146 } 147 }
147 148
148 void LayerTestCommon::LayerImplTest::AppendSurfaceQuadsWithOcclusion( 149 void LayerTestCommon::LayerImplTest::AppendSurfaceQuadsWithOcclusion(
149 LayerImpl* owning_layer_impl, 150 LayerImpl* owning_layer_impl,
150 RenderSurfaceImpl* surface_impl, 151 RenderSurfaceImpl* surface_impl,
151 const gfx::Rect& occluded) { 152 const gfx::Rect& occluded) {
152 AppendQuadsData data; 153 AppendQuadsData data;
153 154
154 quad_culler_->clear_lists(); 155 render_pass_->quad_list.clear();
155 quad_culler_->set_occluded_target_rect_for_contributing_surface(occluded); 156 render_pass_->shared_quad_state_list.clear();
157 occlusion_tracker_.set_occluded_target_rect_for_contributing_surface(
158 occluded);
156 bool for_replica = false; 159 bool for_replica = false;
157 RenderPass::Id id(1, 1); 160 RenderPass::Id id(1, 1);
158 surface_impl->AppendQuads(quad_culler_.get(), &data, for_replica, id); 161 surface_impl->AppendQuads(
162 render_pass_.get(), occlusion_tracker_, &data, for_replica, id);
159 } 163 }
160 164
161 } // namespace cc 165 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698