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

Unified Diff: cc/layer_sorter_unittest.cc

Issue 11362024: added fix that deals with precision in layer sorter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merging with tip of tree Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_sorter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_sorter_unittest.cc
diff --git a/cc/layer_sorter_unittest.cc b/cc/layer_sorter_unittest.cc
index 969810b721096ec5f282cbae01ad9853fe3966f6..d067f07232eee4c6b2e50715d0fe7549142d27f9 100644
--- a/cc/layer_sorter_unittest.cc
+++ b/cc/layer_sorter_unittest.cc
@@ -263,5 +263,55 @@ TEST(LayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff)
EXPECT_EQ(5, layerList[4]->id());
}
+TEST(LayerSorterTest, verifyConcidentLayerPrecisionLossResultsInDocumentOrder)
+{
+ FakeImplProxy proxy;
+ FakeLayerTreeHostImpl hostImpl(&proxy);
+
+ scoped_ptr<LayerImpl> layer1 = LayerImpl::create(hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> layer2 = LayerImpl::create(hostImpl.activeTree(), 2);
+
+ // Layer 1 should occur before layer 2 in paint. However, due to numeric
+ // issues in the sorter, it will put the layers in the wrong order
+ // in some situations. Here we test a patch that results in document
+ // order rather than calculated order when numeric percision is suspect
+ // in calculated order.
+
+ gfx::Transform BehindMatrix;
+ BehindMatrix.Translate3d(0, 0, 0.999999f);
+ BehindMatrix.RotateAboutXAxis(38.5f);
+ BehindMatrix.RotateAboutYAxis(77.0f);
+ gfx::Transform FrontMatrix;
+ FrontMatrix.Translate3d(0, 0, 1.0f);
+ FrontMatrix.RotateAboutXAxis(38.5f);
+ FrontMatrix.RotateAboutYAxis(77.0f);
+
+ layer1->setBounds(gfx::Size(10, 10));
+ layer1->setContentBounds(gfx::Size(10, 10));
+ layer1->drawProperties().target_space_transform = BehindMatrix;
+ layer1->setDrawsContent(true);
+
+ layer2->setBounds(gfx::Size(10, 10));
+ layer2->setContentBounds(gfx::Size(10, 10));
+ layer2->drawProperties().target_space_transform = FrontMatrix;
+ layer2->setDrawsContent(true);
+
+ std::vector<LayerImpl*> layerList;
+ layerList.push_back(layer1.get());
+ layerList.push_back(layer2.get());
+
+ ASSERT_EQ(static_cast<size_t>(2), layerList.size());
+ EXPECT_EQ(1, layerList[0]->id());
+ EXPECT_EQ(2, layerList[1]->id());
+
+ LayerSorter layerSorter;
+ layerSorter.sort(layerList.begin(), layerList.end());
+
+ ASSERT_EQ(static_cast<size_t>(2), layerList.size());
+ EXPECT_EQ(1, layerList[0]->id());
+ EXPECT_EQ(2, layerList[1]->id());
+}
+
} // namespace
} // namespace cc
+
« no previous file with comments | « cc/layer_sorter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698