| OLD | NEW |
| 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/debug/overdraw_metrics.h" | 9 #include "cc/debug/overdraw_metrics.h" |
| 10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| (...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1906 // +--topmost | 1906 // +--topmost |
| 1907 | 1907 |
| 1908 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1908 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1909 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 1909 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
| 1910 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 1910 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
| 1911 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); | 1911 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); |
| 1912 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); | 1912 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); |
| 1913 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), false); | 1913 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
| 1914 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(250, 0), gfx::Size(50, 300), true); | 1914 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(250, 0), gfx::Size(50, 300), true); |
| 1915 | 1915 |
| 1916 addOpacityTransitionToController(*layer->layer_animation_controller(), 1
0, 0, 1, false); | 1916 AddOpacityTransitionToController(layer->layer_animation_controller(), 10
, 0, 1, false); |
| 1917 addOpacityTransitionToController(*surface->layer_animation_controller(),
10, 0, 1, false); | 1917 AddOpacityTransitionToController(surface->layer_animation_controller(),
10, 0, 1, false); |
| 1918 this->calcDrawEtc(parent); | 1918 this->calcDrawEtc(parent); |
| 1919 | 1919 |
| 1920 EXPECT_TRUE(layer->draw_opacity_is_animating()); | 1920 EXPECT_TRUE(layer->draw_opacity_is_animating()); |
| 1921 EXPECT_FALSE(surface->draw_opacity_is_animating()); | 1921 EXPECT_FALSE(surface->draw_opacity_is_animating()); |
| 1922 EXPECT_TRUE(surface->render_surface()->draw_opacity_is_animating()); | 1922 EXPECT_TRUE(surface->render_surface()->draw_opacity_is_animating()); |
| 1923 | 1923 |
| 1924 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1924 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1925 | 1925 |
| 1926 this->visitLayer(topmost, occlusion); | 1926 this->visitLayer(topmost, occlusion); |
| 1927 this->EnterLayer(parent2, occlusion); | 1927 this->EnterLayer(parent2, occlusion); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 void runMyTest() | 1971 void runMyTest() |
| 1972 { | 1972 { |
| 1973 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1973 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1974 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 1974 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
| 1975 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 1975 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
| 1976 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); | 1976 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); |
| 1977 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); | 1977 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); |
| 1978 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), false); | 1978 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
| 1979 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(250, 0), gfx::Size(50, 300), true); | 1979 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(250, 0), gfx::Size(50, 300), true); |
| 1980 | 1980 |
| 1981 addOpacityTransitionToController(*layer->layer_animation_controller(), 1
0, 1, 0, false); | 1981 AddOpacityTransitionToController(layer->layer_animation_controller(), 10
, 1, 0, false); |
| 1982 addOpacityTransitionToController(*surface->layer_animation_controller(),
10, 1, 0, false); | 1982 AddOpacityTransitionToController(surface->layer_animation_controller(),
10, 1, 0, false); |
| 1983 this->calcDrawEtc(parent); | 1983 this->calcDrawEtc(parent); |
| 1984 | 1984 |
| 1985 EXPECT_TRUE(layer->draw_opacity_is_animating()); | 1985 EXPECT_TRUE(layer->draw_opacity_is_animating()); |
| 1986 EXPECT_FALSE(surface->draw_opacity_is_animating()); | 1986 EXPECT_FALSE(surface->draw_opacity_is_animating()); |
| 1987 EXPECT_TRUE(surface->render_surface()->draw_opacity_is_animating()); | 1987 EXPECT_TRUE(surface->render_surface()->draw_opacity_is_animating()); |
| 1988 | 1988 |
| 1989 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1989 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1990 | 1990 |
| 1991 this->visitLayer(topmost, occlusion); | 1991 this->visitLayer(topmost, occlusion); |
| 1992 this->EnterLayer(parent2, occlusion); | 1992 this->EnterLayer(parent2, occlusion); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2035 OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : Occl
usionTrackerTest<Types>(opaqueLayers) {} | 2035 OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : Occl
usionTrackerTest<Types>(opaqueLayers) {} |
| 2036 void runMyTest() | 2036 void runMyTest() |
| 2037 { | 2037 { |
| 2038 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 2038 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 2039 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 2039 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
| 2040 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 2040 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
| 2041 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); | 2041 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); |
| 2042 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); | 2042 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); |
| 2043 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(50, 300), true); | 2043 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(50, 300), true); |
| 2044 | 2044 |
| 2045 addAnimatedTransformToController(*layer->layer_animation_controller(), 1
0, 30, 0); | 2045 AddAnimatedTransformToController(layer->layer_animation_controller(), 10
, 30, 0); |
| 2046 addAnimatedTransformToController(*surface->layer_animation_controller(),
10, 30, 0); | 2046 AddAnimatedTransformToController(surface->layer_animation_controller(),
10, 30, 0); |
| 2047 addAnimatedTransformToController(*surfaceChild->layer_animation_controll
er(), 10, 30, 0); | 2047 AddAnimatedTransformToController(surfaceChild->layer_animation_controlle
r(), 10, 30, 0); |
| 2048 this->calcDrawEtc(parent); | 2048 this->calcDrawEtc(parent); |
| 2049 | 2049 |
| 2050 EXPECT_TRUE(layer->draw_transform_is_animating()); | 2050 EXPECT_TRUE(layer->draw_transform_is_animating()); |
| 2051 EXPECT_TRUE(layer->screen_space_transform_is_animating()); | 2051 EXPECT_TRUE(layer->screen_space_transform_is_animating()); |
| 2052 EXPECT_TRUE(surface->render_surface()->target_surface_transforms_are_ani
mating()); | 2052 EXPECT_TRUE(surface->render_surface()->target_surface_transforms_are_ani
mating()); |
| 2053 EXPECT_TRUE(surface->render_surface()->screen_space_transforms_are_anima
ting()); | 2053 EXPECT_TRUE(surface->render_surface()->screen_space_transforms_are_anima
ting()); |
| 2054 // The surface owning layer doesn't animate against its own surface. | 2054 // The surface owning layer doesn't animate against its own surface. |
| 2055 EXPECT_FALSE(surface->draw_transform_is_animating()); | 2055 EXPECT_FALSE(surface->draw_transform_is_animating()); |
| 2056 EXPECT_TRUE(surface->screen_space_transform_is_animating()); | 2056 EXPECT_TRUE(surface->screen_space_transform_is_animating()); |
| 2057 EXPECT_TRUE(surfaceChild->draw_transform_is_animating()); | 2057 EXPECT_TRUE(surfaceChild->draw_transform_is_animating()); |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3049 hasOcclusionFromOutsideTargetSurface = false; | 3049 hasOcclusionFromOutsideTargetSurface = false; |
| 3050 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.UnoccludedContributing
SurfaceContentRect(smaller, false, gfx::Rect(0, 0, 100, 100), &hasOcclusionFromO
utsideTargetSurface)); | 3050 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.UnoccludedContributing
SurfaceContentRect(smaller, false, gfx::Rect(0, 0, 100, 100), &hasOcclusionFromO
utsideTargetSurface)); |
| 3051 EXPECT_FALSE(hasOcclusionFromOutsideTargetSurface); | 3051 EXPECT_FALSE(hasOcclusionFromOutsideTargetSurface); |
| 3052 } | 3052 } |
| 3053 }; | 3053 }; |
| 3054 | 3054 |
| 3055 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipIsExternalOcclusion) | 3055 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipIsExternalOcclusion) |
| 3056 | 3056 |
| 3057 } // namespace | 3057 } // namespace |
| 3058 } // namespace cc | 3058 } // namespace cc |
| OLD | NEW |