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/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 template <typename LayerType> | 79 template <typename LayerType> |
80 class TestOcclusionTrackerWithClip : public TestOcclusionTracker<LayerType> { | 80 class TestOcclusionTrackerWithClip : public TestOcclusionTracker<LayerType> { |
81 public: | 81 public: |
82 explicit TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect) | 82 explicit TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect) |
83 : TestOcclusionTracker<LayerType>(viewport_rect) {} | 83 : TestOcclusionTracker<LayerType>(viewport_rect) {} |
84 | 84 |
85 bool OccludedLayer(const LayerType* layer, | 85 bool OccludedLayer(const LayerType* layer, |
86 const gfx::Rect& content_rect) const { | 86 const gfx::Rect& content_rect) const { |
87 DCHECK(layer->visible_content_rect().Contains(content_rect)); | 87 DCHECK(layer->visible_content_rect().Contains(content_rect)); |
88 EXPECT_EQ( | |
89 this->Occluded( | |
90 layer->render_target(), content_rect, layer->draw_transform()), | |
91 this->GetCurrentOcclusionForLayer(layer->draw_transform()) | |
92 .IsOccluded(content_rect)); | |
93 return this->Occluded( | 88 return this->Occluded( |
94 layer->render_target(), content_rect, layer->draw_transform()); | 89 layer->render_target(), content_rect, layer->draw_transform()); |
95 } | 90 } |
96 | 91 |
97 // Gives an unoccluded sub-rect of |content_rect| in the content space of the | 92 // Gives an unoccluded sub-rect of |content_rect| in the content space of the |
98 // layer. Simple wrapper around UnoccludedContentRect. | 93 // layer. Simple wrapper around UnoccludedContentRect. |
99 gfx::Rect UnoccludedLayerContentRect(const LayerType* layer, | 94 gfx::Rect UnoccludedLayerContentRect(const LayerType* layer, |
100 const gfx::Rect& content_rect) const { | 95 const gfx::Rect& content_rect) const { |
101 DCHECK(layer->visible_content_rect().Contains(content_rect)); | 96 DCHECK(layer->visible_content_rect().Contains(content_rect)); |
102 return this->UnoccludedContentRect(content_rect, layer->draw_transform()); | 97 return this->UnoccludedContentRect(content_rect, layer->draw_transform()); |
(...skipping 3207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3310 EXPECT_EQ(gfx::Rect(), | 3305 EXPECT_EQ(gfx::Rect(), |
3311 occlusion.UnoccludedSurfaceContentRect( | 3306 occlusion.UnoccludedSurfaceContentRect( |
3312 surface, gfx::Rect(80, 70, 50, 50))); | 3307 surface, gfx::Rect(80, 70, 50, 50))); |
3313 } | 3308 } |
3314 }; | 3309 }; |
3315 | 3310 |
3316 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 3311 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
3317 | 3312 |
3318 } // namespace | 3313 } // namespace |
3319 } // namespace cc | 3314 } // namespace cc |
OLD | NEW |