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)); |
88 return this->Occluded( | 93 return this->Occluded( |
89 layer->render_target(), content_rect, layer->draw_transform()); | 94 layer->render_target(), content_rect, layer->draw_transform()); |
90 } | 95 } |
91 | 96 |
92 // Gives an unoccluded sub-rect of |content_rect| in the content space of the | 97 // Gives an unoccluded sub-rect of |content_rect| in the content space of the |
93 // layer. Simple wrapper around UnoccludedContentRect. | 98 // layer. Simple wrapper around UnoccludedContentRect. |
94 gfx::Rect UnoccludedLayerContentRect(const LayerType* layer, | 99 gfx::Rect UnoccludedLayerContentRect(const LayerType* layer, |
95 const gfx::Rect& content_rect) const { | 100 const gfx::Rect& content_rect) const { |
96 DCHECK(layer->visible_content_rect().Contains(content_rect)); | 101 DCHECK(layer->visible_content_rect().Contains(content_rect)); |
97 return this->UnoccludedContentRect(content_rect, layer->draw_transform()); | 102 return this->UnoccludedContentRect(content_rect, layer->draw_transform()); |
(...skipping 3207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3305 EXPECT_EQ(gfx::Rect(), | 3310 EXPECT_EQ(gfx::Rect(), |
3306 occlusion.UnoccludedSurfaceContentRect( | 3311 occlusion.UnoccludedSurfaceContentRect( |
3307 surface, gfx::Rect(80, 70, 50, 50))); | 3312 surface, gfx::Rect(80, 70, 50, 50))); |
3308 } | 3313 } |
3309 }; | 3314 }; |
3310 | 3315 |
3311 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 3316 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
3312 | 3317 |
3313 } // namespace | 3318 } // namespace |
3314 } // namespace cc | 3319 } // namespace cc |
OLD | NEW |