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

Side by Side Diff: cc/trees/occlusion_tracker_unittest.cc

Issue 332873005: Rendering context information added to SharedQuadState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cc_messages_unittest now builds with new SharedQuadState::SetAll 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/trees/occlusion_tracker.h" 5 #include "cc/trees/occlusion_tracker.h"
6 6
7 #include "cc/animation/layer_animation_controller.h" 7 #include "cc/animation/layer_animation_controller.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/layers/layer.h" 9 #include "cc/layers/layer.h"
10 #include "cc/layers/layer_impl.h" 10 #include "cc/layers/layer_impl.h"
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); 1896 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300));
1897 typename Types::ContentLayerType* child1 = this->CreateDrawingLayer( 1897 typename Types::ContentLayerType* child1 = this->CreateDrawingLayer(
1898 parent, translation_to_back, gfx::PointF(), gfx::Size(100, 100), true); 1898 parent, translation_to_back, gfx::PointF(), gfx::Size(100, 100), true);
1899 typename Types::ContentLayerType* child2 = 1899 typename Types::ContentLayerType* child2 =
1900 this->CreateDrawingLayer(parent, 1900 this->CreateDrawingLayer(parent,
1901 translation_to_front, 1901 translation_to_front,
1902 gfx::PointF(50.f, 50.f), 1902 gfx::PointF(50.f, 50.f),
1903 gfx::Size(100, 100), 1903 gfx::Size(100, 100),
1904 true); 1904 true);
1905 parent->SetShouldFlattenTransform(false); 1905 parent->SetShouldFlattenTransform(false);
1906 parent->SetIs3dSorted(true); 1906 parent->Set3dSortingContextId(1);
1907 child1->SetIs3dSorted(true); 1907 child1->Set3dSortingContextId(1);
1908 child2->SetIs3dSorted(true); 1908 child2->Set3dSortingContextId(1);
1909 1909
1910 this->CalcDrawEtc(parent); 1910 this->CalcDrawEtc(parent);
1911 1911
1912 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 1912 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
1913 gfx::Rect(0, 0, 1000, 1000)); 1913 gfx::Rect(0, 0, 1000, 1000));
1914 this->VisitLayer(child2, &occlusion); 1914 this->VisitLayer(child2, &occlusion);
1915 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); 1915 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty());
1916 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); 1916 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty());
1917 1917
1918 this->VisitLayer(child1, &occlusion); 1918 this->VisitLayer(child1, &occlusion);
(...skipping 23 matching lines...) Expand all
1942 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); 1942 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300));
1943 typename Types::LayerType* container = this->CreateLayer( 1943 typename Types::LayerType* container = this->CreateLayer(
1944 parent, this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); 1944 parent, this->identity_matrix, gfx::PointF(), gfx::Size(300, 300));
1945 typename Types::ContentLayerType* layer = 1945 typename Types::ContentLayerType* layer =
1946 this->CreateDrawingLayer(container, 1946 this->CreateDrawingLayer(container,
1947 transform, 1947 transform,
1948 gfx::PointF(100.f, 100.f), 1948 gfx::PointF(100.f, 100.f),
1949 gfx::Size(200, 200), 1949 gfx::Size(200, 200),
1950 true); 1950 true);
1951 container->SetShouldFlattenTransform(false); 1951 container->SetShouldFlattenTransform(false);
1952 container->SetIs3dSorted(true); 1952 container->Set3dSortingContextId(1);
1953 layer->SetIs3dSorted(true); 1953 layer->Set3dSortingContextId(1);
1954 layer->SetShouldFlattenTransform(false); 1954 layer->SetShouldFlattenTransform(false);
1955 1955
1956 this->CalcDrawEtc(parent); 1956 this->CalcDrawEtc(parent);
1957 1957
1958 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 1958 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
1959 gfx::Rect(0, 0, 1000, 1000)); 1959 gfx::Rect(0, 0, 1000, 1000));
1960 this->EnterLayer(layer, &occlusion); 1960 this->EnterLayer(layer, &occlusion);
1961 1961
1962 EXPECT_RECT_EQ( 1962 EXPECT_RECT_EQ(
1963 gfx::Rect(0, 0, 200, 200), 1963 gfx::Rect(0, 0, 200, 200),
(...skipping 23 matching lines...) Expand all
1987 transform.RotateAboutXAxis(-167.0); 1987 transform.RotateAboutXAxis(-167.0);
1988 transform.Translate(-250.0, -50.0); 1988 transform.Translate(-250.0, -50.0);
1989 1989
1990 typename Types::ContentLayerType* parent = this->CreateRoot( 1990 typename Types::ContentLayerType* parent = this->CreateRoot(
1991 this->identity_matrix, gfx::PointF(), gfx::Size(500, 100)); 1991 this->identity_matrix, gfx::PointF(), gfx::Size(500, 100));
1992 typename Types::LayerType* container = this->CreateLayer( 1992 typename Types::LayerType* container = this->CreateLayer(
1993 parent, this->identity_matrix, gfx::PointF(), gfx::Size(500, 500)); 1993 parent, this->identity_matrix, gfx::PointF(), gfx::Size(500, 500));
1994 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( 1994 typename Types::ContentLayerType* layer = this->CreateDrawingLayer(
1995 container, transform, gfx::PointF(), gfx::Size(500, 500), true); 1995 container, transform, gfx::PointF(), gfx::Size(500, 500), true);
1996 container->SetShouldFlattenTransform(false); 1996 container->SetShouldFlattenTransform(false);
1997 container->SetIs3dSorted(true); 1997 container->Set3dSortingContextId(1);
1998 layer->SetShouldFlattenTransform(false); 1998 layer->SetShouldFlattenTransform(false);
1999 layer->SetIs3dSorted(true); 1999 layer->Set3dSortingContextId(1);
2000 this->CalcDrawEtc(parent); 2000 this->CalcDrawEtc(parent);
2001 2001
2002 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2002 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2003 gfx::Rect(0, 0, 1000, 1000)); 2003 gfx::Rect(0, 0, 1000, 1000));
2004 this->EnterLayer(layer, &occlusion); 2004 this->EnterLayer(layer, &occlusion);
2005 2005
2006 // The bottom 11 pixel rows of this layer remain visible inside the 2006 // The bottom 11 pixel rows of this layer remain visible inside the
2007 // container, after translation to the target surface. When translated back, 2007 // container, after translation to the target surface. When translated back,
2008 // this will include many more pixels but must include at least the bottom 2008 // this will include many more pixels but must include at least the bottom
2009 // 11 rows. 2009 // 11 rows.
(...skipping 20 matching lines...) Expand all
2030 transform.Translate(50.0, 50.0); 2030 transform.Translate(50.0, 50.0);
2031 transform.ApplyPerspectiveDepth(100.0); 2031 transform.ApplyPerspectiveDepth(100.0);
2032 transform.Translate3d(0.0, 0.0, 110.0); 2032 transform.Translate3d(0.0, 0.0, 110.0);
2033 transform.Translate(-50.0, -50.0); 2033 transform.Translate(-50.0, -50.0);
2034 2034
2035 typename Types::ContentLayerType* parent = this->CreateRoot( 2035 typename Types::ContentLayerType* parent = this->CreateRoot(
2036 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); 2036 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100));
2037 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( 2037 typename Types::ContentLayerType* layer = this->CreateDrawingLayer(
2038 parent, transform, gfx::PointF(), gfx::Size(100, 100), true); 2038 parent, transform, gfx::PointF(), gfx::Size(100, 100), true);
2039 parent->SetShouldFlattenTransform(false); 2039 parent->SetShouldFlattenTransform(false);
2040 parent->SetIs3dSorted(true); 2040 parent->Set3dSortingContextId(1);
2041 layer->SetShouldFlattenTransform(false); 2041 layer->SetShouldFlattenTransform(false);
2042 layer->SetIs3dSorted(true); 2042 layer->Set3dSortingContextId(1);
2043 this->CalcDrawEtc(parent); 2043 this->CalcDrawEtc(parent);
2044 2044
2045 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2045 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2046 gfx::Rect(0, 0, 1000, 1000)); 2046 gfx::Rect(0, 0, 1000, 1000));
2047 2047
2048 // The |layer| is entirely behind the camera and should not occlude. 2048 // The |layer| is entirely behind the camera and should not occlude.
2049 this->VisitLayer(layer, &occlusion); 2049 this->VisitLayer(layer, &occlusion);
2050 this->EnterLayer(parent, &occlusion); 2050 this->EnterLayer(parent, &occlusion);
2051 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); 2051 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty());
2052 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); 2052 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty());
(...skipping 18 matching lines...) Expand all
2071 transform.ApplyPerspectiveDepth(100.0); 2071 transform.ApplyPerspectiveDepth(100.0);
2072 transform.Translate3d(0.0, 0.0, 99.0); 2072 transform.Translate3d(0.0, 0.0, 99.0);
2073 transform.Translate(-50.0, -50.0); 2073 transform.Translate(-50.0, -50.0);
2074 2074
2075 typename Types::ContentLayerType* parent = this->CreateRoot( 2075 typename Types::ContentLayerType* parent = this->CreateRoot(
2076 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); 2076 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100));
2077 parent->SetMasksToBounds(true); 2077 parent->SetMasksToBounds(true);
2078 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( 2078 typename Types::ContentLayerType* layer = this->CreateDrawingLayer(
2079 parent, transform, gfx::PointF(), gfx::Size(100, 100), true); 2079 parent, transform, gfx::PointF(), gfx::Size(100, 100), true);
2080 parent->SetShouldFlattenTransform(false); 2080 parent->SetShouldFlattenTransform(false);
2081 parent->SetIs3dSorted(true); 2081 parent->Set3dSortingContextId(1);
2082 layer->SetShouldFlattenTransform(false); 2082 layer->SetShouldFlattenTransform(false);
2083 layer->SetIs3dSorted(true); 2083 layer->Set3dSortingContextId(1);
2084 this->CalcDrawEtc(parent); 2084 this->CalcDrawEtc(parent);
2085 2085
2086 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2086 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2087 gfx::Rect(0, 0, 1000, 1000)); 2087 gfx::Rect(0, 0, 1000, 1000));
2088 2088
2089 // This is very close to the camera, so pixels in its visible_content_rect() 2089 // This is very close to the camera, so pixels in its visible_content_rect()
2090 // will actually go outside of the layer's clip rect. Ensure that those 2090 // will actually go outside of the layer's clip rect. Ensure that those
2091 // pixels don't occlude things outside the clip rect. 2091 // pixels don't occlude things outside the clip rect.
2092 this->VisitLayer(layer, &occlusion); 2092 this->VisitLayer(layer, &occlusion);
2093 this->EnterLayer(parent, &occlusion); 2093 this->EnterLayer(parent, &occlusion);
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
3549 occlusion.occlusion_from_outside_target().ToString()); 3549 occlusion.occlusion_from_outside_target().ToString());
3550 EXPECT_EQ(gfx::Rect().ToString(), 3550 EXPECT_EQ(gfx::Rect().ToString(),
3551 occlusion.occlusion_from_inside_target().ToString()); 3551 occlusion.occlusion_from_inside_target().ToString());
3552 } 3552 }
3553 }; 3553 };
3554 3554
3555 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestHiddenCopyRequestDoesNotOcclude) 3555 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestHiddenCopyRequestDoesNotOcclude)
3556 3556
3557 } // namespace 3557 } // namespace
3558 } // namespace cc 3558 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698