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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "cc/animation/animation_host.h" | 9 #include "cc/animation/animation_host.h" |
10 #include "cc/base/filter_operation.h" | 10 #include "cc/base/filter_operation.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // layer. Simple wrapper around GetUnoccludedContentRect. | 71 // layer. Simple wrapper around GetUnoccludedContentRect. |
72 gfx::Rect UnoccludedLayerContentRect(const LayerImpl* layer, | 72 gfx::Rect UnoccludedLayerContentRect(const LayerImpl* layer, |
73 const gfx::Rect& content_rect) const { | 73 const gfx::Rect& content_rect) const { |
74 DCHECK(layer->visible_layer_rect().Contains(content_rect)); | 74 DCHECK(layer->visible_layer_rect().Contains(content_rect)); |
75 return this->GetCurrentOcclusionForLayer(layer->DrawTransform()) | 75 return this->GetCurrentOcclusionForLayer(layer->DrawTransform()) |
76 .GetUnoccludedContentRect(content_rect); | 76 .GetUnoccludedContentRect(content_rect); |
77 } | 77 } |
78 | 78 |
79 gfx::Rect UnoccludedSurfaceContentRect(const LayerImpl* layer, | 79 gfx::Rect UnoccludedSurfaceContentRect(const LayerImpl* layer, |
80 const gfx::Rect& content_rect) const { | 80 const gfx::Rect& content_rect) const { |
81 const RenderSurfaceImpl* surface = GetRenderSurface(layer); | 81 const RenderSurfaceImpl* surface = |
| 82 GetRenderSurface(const_cast<LayerImpl*>(layer)); |
82 return this->GetCurrentOcclusionForContributingSurface( | 83 return this->GetCurrentOcclusionForContributingSurface( |
83 surface->draw_transform()) | 84 surface->draw_transform()) |
84 .GetUnoccludedContentRect(content_rect); | 85 .GetUnoccludedContentRect(content_rect); |
85 } | 86 } |
86 }; | 87 }; |
87 | 88 |
88 class OcclusionTrackerTest : public testing::Test { | 89 class OcclusionTrackerTest : public testing::Test { |
89 protected: | 90 protected: |
90 explicit OcclusionTrackerTest(bool opaque_layers) | 91 explicit OcclusionTrackerTest(bool opaque_layers) |
91 : opaque_layers_(opaque_layers), | 92 : opaque_layers_(opaque_layers), |
(...skipping 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 EXPECT_EQ(gfx::Rect(), | 2434 EXPECT_EQ(gfx::Rect(), |
2434 occlusion.UnoccludedSurfaceContentRect( | 2435 occlusion.UnoccludedSurfaceContentRect( |
2435 surface, gfx::Rect(80, 70, 50, 50))); | 2436 surface, gfx::Rect(80, 70, 50, 50))); |
2436 } | 2437 } |
2437 }; | 2438 }; |
2438 | 2439 |
2439 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 2440 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
2440 | 2441 |
2441 } // namespace | 2442 } // namespace |
2442 } // namespace cc | 2443 } // namespace cc |
OLD | NEW |