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

Side by Side Diff: cc/layer_tree_host_unittest_occlusion.cc

Issue 12774006: cc: Chromify Layer and LayerImpl classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MoreAndroidCompilings Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host_unittest_delegated.cc ('k') | cc/layer_tree_host_unittest_scroll.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 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/layer_tree_host.h" 5 #include "cc/layer_tree_host.h"
6 6
7 #include "cc/layer.h" 7 #include "cc/layer.h"
8 #include "cc/test/layer_tree_test_common.h" 8 #include "cc/test/layer_tree_test_common.h"
9 #include "cc/test/occlusion_tracker_test_common.h" 9 #include "cc/test/occlusion_tracker_test_common.h"
10 10
11 namespace cc { 11 namespace cc {
12 namespace { 12 namespace {
13 13
14 class TestLayer : public Layer { 14 class TestLayer : public Layer {
15 public: 15 public:
16 static scoped_refptr<TestLayer> Create() { 16 static scoped_refptr<TestLayer> Create() {
17 return make_scoped_refptr(new TestLayer()); 17 return make_scoped_refptr(new TestLayer());
18 } 18 }
19 19
20 virtual void update( 20 virtual void Update(
21 ResourceUpdateQueue& update_queue, 21 ResourceUpdateQueue* update_queue,
22 const OcclusionTracker* occlusion, 22 const OcclusionTracker* occlusion,
23 RenderingStats* stats) OVERRIDE { 23 RenderingStats* stats) OVERRIDE {
24 if (!occlusion) 24 if (!occlusion)
25 return; 25 return;
26 26
27 // Gain access to internals of the OcclusionTracker. 27 // Gain access to internals of the OcclusionTracker.
28 const TestOcclusionTracker* test_occlusion = 28 const TestOcclusionTracker* test_occlusion =
29 static_cast<const TestOcclusionTracker*>(occlusion); 29 static_cast<const TestOcclusionTracker*>(occlusion);
30 occlusion_ = UnionRegions( 30 occlusion_ = UnionRegions(
31 test_occlusion->occlusion_from_inside_target(), 31 test_occlusion->occlusion_from_inside_target(),
32 test_occlusion->occlusion_from_outside_target()); 32 test_occlusion->occlusion_from_outside_target());
33 } 33 }
34 34
35 const Region& occlusion() const { return occlusion_; } 35 const Region& occlusion() const { return occlusion_; }
36 const Region& expected_occlusion() const { return expected_occlusion_; } 36 const Region& expected_occlusion() const { return expected_occlusion_; }
37 void set_expected_occlusion(const Region& occlusion) { 37 void set_expected_occlusion(const Region& occlusion) {
38 expected_occlusion_ = occlusion; 38 expected_occlusion_ = occlusion;
39 } 39 }
40 40
41 private: 41 private:
42 TestLayer() : Layer() { 42 TestLayer() : Layer() {
43 setIsDrawable(true); 43 SetIsDrawable(true);
44 } 44 }
45 virtual ~TestLayer() { } 45 virtual ~TestLayer() { }
46 46
47 Region occlusion_; 47 Region occlusion_;
48 Region expected_occlusion_; 48 Region expected_occlusion_;
49 }; 49 };
50 50
51 class LayerTreeHostOcclusionTest : public ThreadedTest { 51 class LayerTreeHostOcclusionTest : public ThreadedTest {
52 public: 52 public:
53 53
(...skipping 24 matching lines...) Expand all
78 78
79 for (size_t i = 0; i < layer->children().size(); ++i) { 79 for (size_t i = 0; i < layer->children().size(); ++i) {
80 TestLayer* child = static_cast<TestLayer*>(layer->children()[i].get()); 80 TestLayer* child = static_cast<TestLayer*>(layer->children()[i].get());
81 VerifyOcclusion(child); 81 VerifyOcclusion(child);
82 } 82 }
83 } 83 }
84 84
85 void SetLayerPropertiesForTesting( 85 void SetLayerPropertiesForTesting(
86 TestLayer* layer, TestLayer* parent, const gfx::Transform& transform, 86 TestLayer* layer, TestLayer* parent, const gfx::Transform& transform,
87 const gfx::PointF& position, const gfx::Size& bounds, bool opaque) const { 87 const gfx::PointF& position, const gfx::Size& bounds, bool opaque) const {
88 layer->removeAllChildren(); 88 layer->RemoveAllChildren();
89 if (parent) 89 if (parent)
90 parent->addChild(layer); 90 parent->AddChild(layer);
91 layer->setTransform(transform); 91 layer->SetTransform(transform);
92 layer->setPosition(position); 92 layer->SetPosition(position);
93 layer->setBounds(bounds); 93 layer->SetBounds(bounds);
94 layer->setContentsOpaque(opaque); 94 layer->SetContentsOpaque(opaque);
95 95
96 layer->setAnchorPoint(gfx::PointF()); 96 layer->SetAnchorPoint(gfx::PointF());
97 } 97 }
98 98
99 protected: 99 protected:
100 scoped_refptr<TestLayer> root_; 100 scoped_refptr<TestLayer> root_;
101 scoped_refptr<TestLayer> child_; 101 scoped_refptr<TestLayer> child_;
102 scoped_refptr<TestLayer> child2_; 102 scoped_refptr<TestLayer> child2_;
103 scoped_refptr<TestLayer> grand_child_; 103 scoped_refptr<TestLayer> grand_child_;
104 scoped_refptr<TestLayer> mask_; 104 scoped_refptr<TestLayer> mask_;
105 105
106 gfx::Transform identity_matrix_; 106 gfx::Transform identity_matrix_;
107 }; 107 };
108 108
109 109
110 class LayerTreeHostOcclusionTestOcclusionSurfaceClipping : 110 class LayerTreeHostOcclusionTestOcclusionSurfaceClipping :
111 public LayerTreeHostOcclusionTest { 111 public LayerTreeHostOcclusionTest {
112 public: 112 public:
113 virtual void setupTree() OVERRIDE { 113 virtual void setupTree() OVERRIDE {
114 // The child layer is a surface and the grandChild is opaque, but clipped to 114 // The child layer is a surface and the grandChild is opaque, but clipped to
115 // the child and root 115 // the child and root
116 SetLayerPropertiesForTesting( 116 SetLayerPropertiesForTesting(
117 root_.get(), NULL, identity_matrix_, 117 root_.get(), NULL, identity_matrix_,
118 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 118 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
119 SetLayerPropertiesForTesting( 119 SetLayerPropertiesForTesting(
120 child_.get(), root_.get(), identity_matrix_, 120 child_.get(), root_.get(), identity_matrix_,
121 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false); 121 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false);
122 SetLayerPropertiesForTesting( 122 SetLayerPropertiesForTesting(
123 grand_child_.get(), child_.get(), identity_matrix_, 123 grand_child_.get(), child_.get(), identity_matrix_,
124 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 124 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
125 125
126 child_->setMasksToBounds(true); 126 child_->SetMasksToBounds(true);
127 child_->setForceRenderSurface(true); 127 child_->SetForceRenderSurface(true);
128 128
129 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); 129 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190));
130 root_->set_expected_occlusion(gfx::Rect(10, 10, 10, 190)); 130 root_->set_expected_occlusion(gfx::Rect(10, 10, 10, 190));
131 131
132 m_layerTreeHost->setRootLayer(root_); 132 m_layerTreeHost->setRootLayer(root_);
133 ThreadedTest::setupTree(); 133 ThreadedTest::setupTree();
134 } 134 }
135 }; 135 };
136 136
137 SINGLE_AND_MULTI_THREAD_TEST_F( 137 SINGLE_AND_MULTI_THREAD_TEST_F(
138 LayerTreeHostOcclusionTestOcclusionSurfaceClipping) 138 LayerTreeHostOcclusionTestOcclusionSurfaceClipping)
139 139
140 class LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque : 140 class LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque :
141 public LayerTreeHostOcclusionTest { 141 public LayerTreeHostOcclusionTest {
142 public: 142 public:
143 virtual void setupTree() OVERRIDE { 143 virtual void setupTree() OVERRIDE {
144 // If the child layer is opaque, then it adds to the occlusion seen by the 144 // If the child layer is opaque, then it adds to the occlusion seen by the
145 // root_. 145 // root_.
146 SetLayerPropertiesForTesting( 146 SetLayerPropertiesForTesting(
147 root_.get(), NULL, identity_matrix_, 147 root_.get(), NULL, identity_matrix_,
148 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 148 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
149 SetLayerPropertiesForTesting( 149 SetLayerPropertiesForTesting(
150 child_.get(), root_.get(), identity_matrix_, 150 child_.get(), root_.get(), identity_matrix_,
151 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 151 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
152 SetLayerPropertiesForTesting( 152 SetLayerPropertiesForTesting(
153 grand_child_.get(), child_.get(), identity_matrix_, 153 grand_child_.get(), child_.get(), identity_matrix_,
154 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 154 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
155 155
156 child_->setMasksToBounds(true); 156 child_->SetMasksToBounds(true);
157 child_->setForceRenderSurface(true); 157 child_->SetForceRenderSurface(true);
158 158
159 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); 159 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190));
160 root_->set_expected_occlusion(gfx::Rect(10, 10, 190, 190)); 160 root_->set_expected_occlusion(gfx::Rect(10, 10, 190, 190));
161 161
162 m_layerTreeHost->setRootLayer(root_); 162 m_layerTreeHost->setRootLayer(root_);
163 ThreadedTest::setupTree(); 163 ThreadedTest::setupTree();
164 } 164 }
165 }; 165 };
166 166
167 SINGLE_AND_MULTI_THREAD_TEST_F( 167 SINGLE_AND_MULTI_THREAD_TEST_F(
(...skipping 10 matching lines...) Expand all
178 SetLayerPropertiesForTesting( 178 SetLayerPropertiesForTesting(
179 child_.get(), root_.get(), identity_matrix_, 179 child_.get(), root_.get(), identity_matrix_,
180 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false); 180 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false);
181 SetLayerPropertiesForTesting( 181 SetLayerPropertiesForTesting(
182 grand_child_.get(), child_.get(), identity_matrix_, 182 grand_child_.get(), child_.get(), identity_matrix_,
183 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 183 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
184 SetLayerPropertiesForTesting( 184 SetLayerPropertiesForTesting(
185 child2_.get(), root_.get(), identity_matrix_, 185 child2_.get(), root_.get(), identity_matrix_,
186 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); 186 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
187 187
188 child_->setMasksToBounds(true); 188 child_->SetMasksToBounds(true);
189 child_->setForceRenderSurface(true); 189 child_->SetForceRenderSurface(true);
190 190
191 grand_child_->set_expected_occlusion(gfx::Rect(10, 0, 10, 190)); 191 grand_child_->set_expected_occlusion(gfx::Rect(10, 0, 10, 190));
192 child_->set_expected_occlusion(gfx::Rect(0, 0, 20, 190)); 192 child_->set_expected_occlusion(gfx::Rect(0, 0, 20, 190));
193 root_->set_expected_occlusion(gfx::Rect(10, 10, 20, 190)); 193 root_->set_expected_occlusion(gfx::Rect(10, 10, 20, 190));
194 194
195 m_layerTreeHost->setRootLayer(root_); 195 m_layerTreeHost->setRootLayer(root_);
196 ThreadedTest::setupTree(); 196 ThreadedTest::setupTree();
197 } 197 }
198 }; 198 };
199 199
(...skipping 12 matching lines...) Expand all
212 SetLayerPropertiesForTesting( 212 SetLayerPropertiesForTesting(
213 child2_.get(), root_.get(), identity_matrix_, 213 child2_.get(), root_.get(), identity_matrix_,
214 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 214 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
215 SetLayerPropertiesForTesting( 215 SetLayerPropertiesForTesting(
216 child_.get(), root_.get(), identity_matrix_, 216 child_.get(), root_.get(), identity_matrix_,
217 gfx::PointF(20.f, 20.f), gfx::Size(500, 500), true); 217 gfx::PointF(20.f, 20.f), gfx::Size(500, 500), true);
218 SetLayerPropertiesForTesting( 218 SetLayerPropertiesForTesting(
219 grand_child_.get(), child_.get(), identity_matrix_, 219 grand_child_.get(), child_.get(), identity_matrix_,
220 gfx::PointF(-10.f, -10.f), gfx::Size(500, 500), true); 220 gfx::PointF(-10.f, -10.f), gfx::Size(500, 500), true);
221 221
222 child_->setMasksToBounds(true); 222 child_->SetMasksToBounds(true);
223 child_->setForceRenderSurface(true); 223 child_->SetForceRenderSurface(true);
224 child_->setMaskLayer(mask_.get()); 224 child_->SetMaskLayer(mask_.get());
225 225
226 child_->set_expected_occlusion(gfx::Rect(0, 0, 180, 180)); 226 child_->set_expected_occlusion(gfx::Rect(0, 0, 180, 180));
227 root_->set_expected_occlusion(gfx::Rect(10, 10, 190, 190)); 227 root_->set_expected_occlusion(gfx::Rect(10, 10, 190, 190));
228 228
229 m_layerTreeHost->setRootLayer(root_); 229 m_layerTreeHost->setRootLayer(root_);
230 ThreadedTest::setupTree(); 230 ThreadedTest::setupTree();
231 } 231 }
232 }; 232 };
233 233
234 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionMask) 234 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionMask)
(...skipping 11 matching lines...) Expand all
246 SetLayerPropertiesForTesting( 246 SetLayerPropertiesForTesting(
247 child_.get(), root_.get(), identity_matrix_, 247 child_.get(), root_.get(), identity_matrix_,
248 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 248 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
249 SetLayerPropertiesForTesting( 249 SetLayerPropertiesForTesting(
250 grand_child_.get(), child_.get(), identity_matrix_, 250 grand_child_.get(), child_.get(), identity_matrix_,
251 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 251 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
252 SetLayerPropertiesForTesting( 252 SetLayerPropertiesForTesting(
253 child2_.get(), root_.get(), identity_matrix_, 253 child2_.get(), root_.get(), identity_matrix_,
254 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); 254 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
255 255
256 child_->setMasksToBounds(true); 256 child_->SetMasksToBounds(true);
257 child_->setForceRenderSurface(true); 257 child_->SetForceRenderSurface(true);
258 child_->setMaskLayer(mask_.get()); 258 child_->SetMaskLayer(mask_.get());
259 259
260 grand_child_->set_expected_occlusion(gfx::Rect(10, 0, 10, 190)); 260 grand_child_->set_expected_occlusion(gfx::Rect(10, 0, 10, 190));
261 child_->set_expected_occlusion(gfx::Rect(0, 0, 20, 190)); 261 child_->set_expected_occlusion(gfx::Rect(0, 0, 20, 190));
262 root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190)); 262 root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190));
263 263
264 m_layerTreeHost->setRootLayer(root_); 264 m_layerTreeHost->setRootLayer(root_);
265 ThreadedTest::setupTree(); 265 ThreadedTest::setupTree();
266 } 266 }
267 }; 267 };
268 268
(...skipping 12 matching lines...) Expand all
281 SetLayerPropertiesForTesting( 281 SetLayerPropertiesForTesting(
282 child2_.get(), root_.get(), identity_matrix_, 282 child2_.get(), root_.get(), identity_matrix_,
283 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); 283 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
284 SetLayerPropertiesForTesting( 284 SetLayerPropertiesForTesting(
285 child_.get(), root_.get(), identity_matrix_, 285 child_.get(), root_.get(), identity_matrix_,
286 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 286 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
287 SetLayerPropertiesForTesting( 287 SetLayerPropertiesForTesting(
288 grand_child_.get(), child_.get(), identity_matrix_, 288 grand_child_.get(), child_.get(), identity_matrix_,
289 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 289 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
290 290
291 child_->setMasksToBounds(true); 291 child_->SetMasksToBounds(true);
292 child_->setForceRenderSurface(true); 292 child_->SetForceRenderSurface(true);
293 child_->setOpacity(0.5f); 293 child_->SetOpacity(0.5f);
294 294
295 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); 295 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190));
296 root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190)); 296 root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190));
297 297
298 m_layerTreeHost->setRootLayer(root_); 298 m_layerTreeHost->setRootLayer(root_);
299 ThreadedTest::setupTree(); 299 ThreadedTest::setupTree();
300 } 300 }
301 }; 301 };
302 302
303 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionOpacity) 303 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionOpacity)
(...skipping 11 matching lines...) Expand all
315 SetLayerPropertiesForTesting( 315 SetLayerPropertiesForTesting(
316 child_.get(), root_.get(), identity_matrix_, 316 child_.get(), root_.get(), identity_matrix_,
317 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 317 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
318 SetLayerPropertiesForTesting( 318 SetLayerPropertiesForTesting(
319 grand_child_.get(), child_.get(), identity_matrix_, 319 grand_child_.get(), child_.get(), identity_matrix_,
320 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 320 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
321 SetLayerPropertiesForTesting( 321 SetLayerPropertiesForTesting(
322 child2_.get(), root_.get(), identity_matrix_, 322 child2_.get(), root_.get(), identity_matrix_,
323 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); 323 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
324 324
325 child_->setMasksToBounds(true); 325 child_->SetMasksToBounds(true);
326 child_->setForceRenderSurface(true); 326 child_->SetForceRenderSurface(true);
327 child_->setOpacity(0.5f); 327 child_->SetOpacity(0.5f);
328 328
329 grand_child_->set_expected_occlusion(gfx::Rect(10, 0, 10, 190)); 329 grand_child_->set_expected_occlusion(gfx::Rect(10, 0, 10, 190));
330 child_->set_expected_occlusion(gfx::Rect(0, 0, 20, 190)); 330 child_->set_expected_occlusion(gfx::Rect(0, 0, 20, 190));
331 root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190)); 331 root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190));
332 332
333 m_layerTreeHost->setRootLayer(root_); 333 m_layerTreeHost->setRootLayer(root_);
334 ThreadedTest::setupTree(); 334 ThreadedTest::setupTree();
335 } 335 }
336 }; 336 };
337 337
(...skipping 21 matching lines...) Expand all
359 SetLayerPropertiesForTesting( 359 SetLayerPropertiesForTesting(
360 child_.get(), root_.get(), childTransform, 360 child_.get(), root_.get(), childTransform,
361 gfx::PointF(30.f, 30.f), gfx::Size(500, 500), true); 361 gfx::PointF(30.f, 30.f), gfx::Size(500, 500), true);
362 SetLayerPropertiesForTesting( 362 SetLayerPropertiesForTesting(
363 grand_child_.get(), child_.get(), identity_matrix_, 363 grand_child_.get(), child_.get(), identity_matrix_,
364 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 364 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
365 SetLayerPropertiesForTesting( 365 SetLayerPropertiesForTesting(
366 child2_.get(), root_.get(), identity_matrix_, 366 child2_.get(), root_.get(), identity_matrix_,
367 gfx::PointF(10.f, 70.f), gfx::Size(500, 500), true); 367 gfx::PointF(10.f, 70.f), gfx::Size(500, 500), true);
368 368
369 child_->setMasksToBounds(true); 369 child_->SetMasksToBounds(true);
370 child_->setFilters(filters); 370 child_->SetFilters(filters);
371 371
372 grand_child_->set_expected_occlusion(gfx::Rect(40, 330, 130, 190)); 372 grand_child_->set_expected_occlusion(gfx::Rect(40, 330, 130, 190));
373 child_->set_expected_occlusion(UnionRegions( 373 child_->set_expected_occlusion(UnionRegions(
374 gfx::Rect(10, 330, 160, 170), gfx::Rect(40, 500, 130, 20))); 374 gfx::Rect(10, 330, 160, 170), gfx::Rect(40, 500, 130, 20)));
375 root_->set_expected_occlusion(gfx::Rect(10, 70, 190, 130)); 375 root_->set_expected_occlusion(gfx::Rect(10, 70, 190, 130));
376 376
377 m_layerTreeHost->setRootLayer(root_); 377 m_layerTreeHost->setRootLayer(root_);
378 ThreadedTest::setupTree(); 378 ThreadedTest::setupTree();
379 } 379 }
380 }; 380 };
(...skipping 22 matching lines...) Expand all
403 SetLayerPropertiesForTesting( 403 SetLayerPropertiesForTesting(
404 child_.get(), root_.get(), childTransform, 404 child_.get(), root_.get(), childTransform,
405 gfx::PointF(30.f, 30.f), gfx::Size(500, 500), true); 405 gfx::PointF(30.f, 30.f), gfx::Size(500, 500), true);
406 SetLayerPropertiesForTesting( 406 SetLayerPropertiesForTesting(
407 grand_child_.get(), child_.get(), identity_matrix_, 407 grand_child_.get(), child_.get(), identity_matrix_,
408 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 408 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
409 SetLayerPropertiesForTesting( 409 SetLayerPropertiesForTesting(
410 child2_.get(), root_.get(), identity_matrix_, 410 child2_.get(), root_.get(), identity_matrix_,
411 gfx::PointF(10.f, 70.f), gfx::Size(500, 500), true); 411 gfx::PointF(10.f, 70.f), gfx::Size(500, 500), true);
412 412
413 child_->setMasksToBounds(true); 413 child_->SetMasksToBounds(true);
414 child_->setFilters(filters); 414 child_->SetFilters(filters);
415 415
416 child_->set_expected_occlusion(gfx::Rect(10, 330, 160, 170)); 416 child_->set_expected_occlusion(gfx::Rect(10, 330, 160, 170));
417 root_->set_expected_occlusion(gfx::Rect(10, 70, 190, 130)); 417 root_->set_expected_occlusion(gfx::Rect(10, 70, 190, 130));
418 418
419 m_layerTreeHost->setRootLayer(root_); 419 m_layerTreeHost->setRootLayer(root_);
420 ThreadedTest::setupTree(); 420 ThreadedTest::setupTree();
421 } 421 }
422 }; 422 };
423 423
424 SINGLE_AND_MULTI_THREAD_TEST_F( 424 SINGLE_AND_MULTI_THREAD_TEST_F(
(...skipping 10 matching lines...) Expand all
435 int root_width = 400; 435 int root_width = 400;
436 int root_height = 400; 436 int root_height = 400;
437 437
438 for (int i = 0; i < num_surfaces; ++i) { 438 for (int i = 0; i < num_surfaces; ++i) {
439 layers.push_back(TestLayer::Create()); 439 layers.push_back(TestLayer::Create());
440 if (!i) { 440 if (!i) {
441 SetLayerPropertiesForTesting( 441 SetLayerPropertiesForTesting(
442 layers.back().get(), NULL, identity_matrix_, 442 layers.back().get(), NULL, identity_matrix_,
443 gfx::PointF(0.f, 0.f), 443 gfx::PointF(0.f, 0.f),
444 gfx::Size(root_width, root_height), true); 444 gfx::Size(root_width, root_height), true);
445 layers.back()->createRenderSurface(); 445 layers.back()->CreateRenderSurface();
446 } else { 446 } else {
447 SetLayerPropertiesForTesting( 447 SetLayerPropertiesForTesting(
448 layers.back().get(), layers[layers.size() - 2].get(), 448 layers.back().get(), layers[layers.size() - 2].get(),
449 identity_matrix_, 449 identity_matrix_,
450 gfx::PointF(1.f, 1.f), 450 gfx::PointF(1.f, 1.f),
451 gfx::Size(root_width-i, root_height-i), true); 451 gfx::Size(root_width-i, root_height-i), true);
452 layers.back()->setForceRenderSurface(true); 452 layers.back()->SetForceRenderSurface(true);
453 } 453 }
454 } 454 }
455 455
456 for (int i = 1; i < num_surfaces; ++i) { 456 for (int i = 1; i < num_surfaces; ++i) {
457 scoped_refptr<TestLayer> child = TestLayer::Create(); 457 scoped_refptr<TestLayer> child = TestLayer::Create();
458 SetLayerPropertiesForTesting( 458 SetLayerPropertiesForTesting(
459 child.get(), layers[i].get(), identity_matrix_, 459 child.get(), layers[i].get(), identity_matrix_,
460 gfx::PointF(0.f, 0.f), gfx::Size(root_width, root_height), false); 460 gfx::PointF(0.f, 0.f), gfx::Size(root_width, root_height), false);
461 } 461 }
462 462
463 for (int i = 0; i < num_surfaces-1; ++i) { 463 for (int i = 0; i < num_surfaces-1; ++i) {
464 gfx::Rect expected_occlusion(1, 1, root_width-i-1, root_height-i-1); 464 gfx::Rect expected_occlusion(1, 1, root_width-i-1, root_height-i-1);
465 layers[i]->set_expected_occlusion(expected_occlusion); 465 layers[i]->set_expected_occlusion(expected_occlusion);
466 } 466 }
467 467
468 m_layerTreeHost->setRootLayer(layers[0].get()); 468 m_layerTreeHost->setRootLayer(layers[0].get());
469 ThreadedTest::setupTree(); 469 ThreadedTest::setupTree();
470 } 470 }
471 }; 471 };
472 472
473 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestManySurfaces) 473 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestManySurfaces)
474 474
475 } // namespace 475 } // namespace
476 } // namespace cc 476 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_unittest_delegated.cc ('k') | cc/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698