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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 return this->GetCurrentOcclusionForLayer(layer->draw_transform()) | 88 return this->GetCurrentOcclusionForLayer(layer->draw_transform()) |
89 .IsOccluded(content_rect); | 89 .IsOccluded(content_rect); |
90 } | 90 } |
91 | 91 |
92 // 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 |
93 // layer. Simple wrapper around UnoccludedContentRect. | 93 // layer. Simple wrapper around GetUnoccludedContentRect. |
94 gfx::Rect UnoccludedLayerContentRect(const LayerType* layer, | 94 gfx::Rect UnoccludedLayerContentRect(const LayerType* layer, |
95 const gfx::Rect& content_rect) const { | 95 const gfx::Rect& content_rect) const { |
96 DCHECK(layer->visible_content_rect().Contains(content_rect)); | 96 DCHECK(layer->visible_content_rect().Contains(content_rect)); |
97 return this->UnoccludedContentRect(content_rect, layer->draw_transform()); | 97 return this->GetCurrentOcclusionForLayer(layer->draw_transform()) |
| 98 .GetUnoccludedContentRect(content_rect); |
98 } | 99 } |
99 | 100 |
100 gfx::Rect UnoccludedSurfaceContentRect(const LayerType* layer, | 101 gfx::Rect UnoccludedSurfaceContentRect(const LayerType* layer, |
101 const gfx::Rect& content_rect) const { | 102 const gfx::Rect& content_rect) const { |
102 typename LayerType::RenderSurfaceType* surface = layer->render_surface(); | 103 typename LayerType::RenderSurfaceType* surface = layer->render_surface(); |
103 return this->UnoccludedContributingSurfaceContentRect( | 104 return this->UnoccludedContributingSurfaceContentRect( |
104 content_rect, surface->draw_transform()); | 105 content_rect, surface->draw_transform()); |
105 } | 106 } |
106 }; | 107 }; |
107 | 108 |
(...skipping 3197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3305 EXPECT_EQ(gfx::Rect(), | 3306 EXPECT_EQ(gfx::Rect(), |
3306 occlusion.UnoccludedSurfaceContentRect( | 3307 occlusion.UnoccludedSurfaceContentRect( |
3307 surface, gfx::Rect(80, 70, 50, 50))); | 3308 surface, gfx::Rect(80, 70, 50, 50))); |
3308 } | 3309 } |
3309 }; | 3310 }; |
3310 | 3311 |
3311 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 3312 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
3312 | 3313 |
3313 } // namespace | 3314 } // namespace |
3314 } // namespace cc | 3315 } // namespace cc |
OLD | NEW |