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

Side by Side Diff: cc/layer_sorter_unittest.cc

Issue 12648005: cc: Chromify the LayerTreeHostImpl class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compl 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_impl_unittest.cc ('k') | cc/layer_tree_host.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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_sorter.h" 5 #include "cc/layer_sorter.h"
6 6
7 #include "cc/layer_impl.h" 7 #include "cc/layer_impl.h"
8 #include "cc/math_util.h" 8 #include "cc/math_util.h"
9 #include "cc/single_thread_proxy.h" 9 #include "cc/single_thread_proxy.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // Expected output: [3, 4, 1, 2, 5]. 205 // Expected output: [3, 4, 1, 2, 5].
206 // - 1, 2, and 5 do not have a 3d z difference, and therefore their 206 // - 1, 2, and 5 do not have a 3d z difference, and therefore their
207 // relative ordering should be retained. 207 // relative ordering should be retained.
208 // - 3 and 4 do not have a 3d z difference, and therefore their relative 208 // - 3 and 4 do not have a 3d z difference, and therefore their relative
209 // ordering should be retained. 209 // ordering should be retained.
210 // - 3 and 4 should be re-sorted so they are in front of 1, 2, and 5. 210 // - 3 and 4 should be re-sorted so they are in front of 1, 2, and 5.
211 211
212 FakeImplProxy proxy; 212 FakeImplProxy proxy;
213 FakeLayerTreeHostImpl host_impl(&proxy); 213 FakeLayerTreeHostImpl host_impl(&proxy);
214 214
215 scoped_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.activeTree(), 1); 215 scoped_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.active_tree(), 1);
216 scoped_ptr<LayerImpl> layer2 = LayerImpl::Create(host_impl.activeTree(), 2); 216 scoped_ptr<LayerImpl> layer2 = LayerImpl::Create(host_impl.active_tree(), 2);
217 scoped_ptr<LayerImpl> layer3 = LayerImpl::Create(host_impl.activeTree(), 3); 217 scoped_ptr<LayerImpl> layer3 = LayerImpl::Create(host_impl.active_tree(), 3);
218 scoped_ptr<LayerImpl> layer4 = LayerImpl::Create(host_impl.activeTree(), 4); 218 scoped_ptr<LayerImpl> layer4 = LayerImpl::Create(host_impl.active_tree(), 4);
219 scoped_ptr<LayerImpl> layer5 = LayerImpl::Create(host_impl.activeTree(), 5); 219 scoped_ptr<LayerImpl> layer5 = LayerImpl::Create(host_impl.active_tree(), 5);
220 220
221 gfx::Transform BehindMatrix; 221 gfx::Transform BehindMatrix;
222 BehindMatrix.Translate3d(0.0, 0.0, 2.0); 222 BehindMatrix.Translate3d(0.0, 0.0, 2.0);
223 gfx::Transform FrontMatrix; 223 gfx::Transform FrontMatrix;
224 FrontMatrix.Translate3d(0.0, 0.0, 1.0); 224 FrontMatrix.Translate3d(0.0, 0.0, 1.0);
225 225
226 layer1->SetBounds(gfx::Size(10, 10)); 226 layer1->SetBounds(gfx::Size(10, 10));
227 layer1->SetContentBounds(gfx::Size(10, 10)); 227 layer1->SetContentBounds(gfx::Size(10, 10));
228 layer1->draw_properties().target_space_transform = BehindMatrix; 228 layer1->draw_properties().target_space_transform = BehindMatrix;
229 layer1->SetDrawsContent(true); 229 layer1->SetDrawsContent(true);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 EXPECT_EQ(4, layer_list[1]->id()); 270 EXPECT_EQ(4, layer_list[1]->id());
271 EXPECT_EQ(1, layer_list[2]->id()); 271 EXPECT_EQ(1, layer_list[2]->id());
272 EXPECT_EQ(2, layer_list[3]->id()); 272 EXPECT_EQ(2, layer_list[3]->id());
273 EXPECT_EQ(5, layer_list[4]->id()); 273 EXPECT_EQ(5, layer_list[4]->id());
274 } 274 }
275 275
276 TEST(LayerSorterTest, VerifyConcidentLayerPrecisionLossResultsInDocumentOrder) { 276 TEST(LayerSorterTest, VerifyConcidentLayerPrecisionLossResultsInDocumentOrder) {
277 FakeImplProxy proxy; 277 FakeImplProxy proxy;
278 FakeLayerTreeHostImpl host_impl(&proxy); 278 FakeLayerTreeHostImpl host_impl(&proxy);
279 279
280 scoped_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.activeTree(), 1); 280 scoped_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.active_tree(), 1);
281 scoped_ptr<LayerImpl> layer2 = LayerImpl::Create(host_impl.activeTree(), 2); 281 scoped_ptr<LayerImpl> layer2 = LayerImpl::Create(host_impl.active_tree(), 2);
282 282
283 // Layer 1 should occur before layer 2 in paint. However, due to numeric 283 // Layer 1 should occur before layer 2 in paint. However, due to numeric
284 // issues in the sorter, it will put the layers in the wrong order 284 // issues in the sorter, it will put the layers in the wrong order
285 // in some situations. Here we test a patch that results in document 285 // in some situations. Here we test a patch that results in document
286 // order rather than calculated order when numeric percision is suspect 286 // order rather than calculated order when numeric percision is suspect
287 // in calculated order. 287 // in calculated order.
288 288
289 gfx::Transform BehindMatrix; 289 gfx::Transform BehindMatrix;
290 BehindMatrix.Translate3d(0.0, 0.0, 0.999999); 290 BehindMatrix.Translate3d(0.0, 0.0, 0.999999);
291 BehindMatrix.RotateAboutXAxis(38.5); 291 BehindMatrix.RotateAboutXAxis(38.5);
(...skipping 25 matching lines...) Expand all
317 layer_sorter.Sort(layer_list.begin(), layer_list.end()); 317 layer_sorter.Sort(layer_list.begin(), layer_list.end());
318 318
319 ASSERT_EQ(2u, layer_list.size()); 319 ASSERT_EQ(2u, layer_list.size());
320 EXPECT_EQ(1, layer_list[0]->id()); 320 EXPECT_EQ(1, layer_list[0]->id());
321 EXPECT_EQ(2, layer_list[1]->id()); 321 EXPECT_EQ(2, layer_list[1]->id());
322 } 322 }
323 323
324 } // namespace 324 } // namespace
325 } // namespace cc 325 } // namespace cc
326 326
OLDNEW
« no previous file with comments | « cc/layer_impl_unittest.cc ('k') | cc/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698