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

Unified Diff: cc/trees/occlusion_tracker_unittest.cc

Issue 998023002: Revert of Splitting of layers for correct intersections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/occlusion_tracker.cc ('k') | ui/gfx/geometry/quad_f.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/occlusion_tracker_unittest.cc
diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc
index f3f218570eb52a71f989222dc88afc1ca3c53371..e3639adeb0a99f04a9022e459b09fd3aedda8204 100644
--- a/cc/trees/occlusion_tracker_unittest.cc
+++ b/cc/trees/occlusion_tracker_unittest.cc
@@ -1539,6 +1539,56 @@
EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty());
}
};
+
+// This test requires accumulating occlusion of 3d layers, which are skipped by
+// the occlusion tracker on the main thread. So this test should run on the impl
+// thread.
+IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude);
+
+template <class Types>
+class OcclusionTrackerTestLargePixelsOccludeInsideClipRect
+ : public OcclusionTrackerTest<Types> {
+ protected:
+ explicit OcclusionTrackerTestLargePixelsOccludeInsideClipRect(
+ bool opaque_layers)
+ : OcclusionTrackerTest<Types>(opaque_layers) {}
+ void RunMyTest() override {
+ gfx::Transform transform;
+ transform.Translate(50.0, 50.0);
+ transform.ApplyPerspectiveDepth(100.0);
+ transform.Translate3d(0.0, 0.0, 99.0);
+ transform.Translate(-50.0, -50.0);
+
+ typename Types::ContentLayerType* parent = this->CreateRoot(
+ this->identity_matrix, gfx::PointF(), gfx::Size(100, 100));
+ parent->SetMasksToBounds(true);
+ typename Types::ContentLayerType* layer = this->CreateDrawingLayer(
+ parent, transform, gfx::PointF(), gfx::Size(100, 100), true);
+ parent->SetShouldFlattenTransform(false);
+ parent->Set3dSortingContextId(1);
+ layer->SetShouldFlattenTransform(false);
+ layer->Set3dSortingContextId(1);
+ this->CalcDrawEtc(parent);
+
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
+ gfx::Rect(0, 0, 1000, 1000));
+
+ // This is very close to the camera, so pixels in its visible_content_rect()
+ // will actually go outside of the layer's clip rect. Ensure that those
+ // pixels don't occlude things outside the clip rect.
+ this->VisitLayer(layer, &occlusion);
+ this->EnterLayer(parent, &occlusion);
+ EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(),
+ occlusion.occlusion_from_inside_target().ToString());
+ EXPECT_EQ(gfx::Rect().ToString(),
+ occlusion.occlusion_from_outside_target().ToString());
+ }
+};
+
+// This test requires accumulating occlusion of 3d layers, which are skipped by
+// the occlusion tracker on the main thread. So this test should run on the impl
+// thread.
+IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect);
template <class Types>
class OcclusionTrackerTestAnimationOpacity1OnMainThread
« no previous file with comments | « cc/trees/occlusion_tracker.cc ('k') | ui/gfx/geometry/quad_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698