| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CC_TEST_TEST_OCCLUSION_TRACKER_H_ | 5 #ifndef CC_TEST_TEST_OCCLUSION_TRACKER_H_ |
| 6 #define CC_TEST_TEST_OCCLUSION_TRACKER_H_ | 6 #define CC_TEST_TEST_OCCLUSION_TRACKER_H_ |
| 7 | 7 |
| 8 #include "cc/layers/render_surface.h" | 8 #include "cc/layers/render_surface.h" |
| 9 #include "cc/layers/render_surface_impl.h" | 9 #include "cc/layers/render_surface_impl.h" |
| 10 #include "cc/trees/occlusion_tracker.h" | 10 #include "cc/trees/occlusion_tracker.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 // A subclass to expose the total current occlusion. | 14 // A subclass to expose the total current occlusion. |
| 15 template <typename LayerType> | 15 template <typename LayerType> |
| 16 class TestOcclusionTracker : public OcclusionTracker<LayerType> { | 16 class TestOcclusionTracker : public OcclusionTracker<LayerType> { |
| 17 public: | 17 public: |
| 18 TestOcclusionTracker(const gfx::Rect& screen_scissor_rect, | 18 explicit TestOcclusionTracker(const gfx::Rect& screen_scissor_rect) |
| 19 bool record_metrics_for_frame) | 19 : OcclusionTracker<LayerType>(screen_scissor_rect) {} |
| 20 : OcclusionTracker<LayerType>(screen_scissor_rect, | |
| 21 record_metrics_for_frame) {} | |
| 22 | 20 |
| 23 Region occlusion_from_inside_target() const { | 21 Region occlusion_from_inside_target() const { |
| 24 return OcclusionTracker<LayerType>::stack_.back() | 22 return OcclusionTracker<LayerType>::stack_.back() |
| 25 .occlusion_from_inside_target; | 23 .occlusion_from_inside_target; |
| 26 } | 24 } |
| 27 Region occlusion_from_outside_target() const { | 25 Region occlusion_from_outside_target() const { |
| 28 return OcclusionTracker<LayerType>::stack_.back() | 26 return OcclusionTracker<LayerType>::stack_.back() |
| 29 .occlusion_from_outside_target; | 27 .occlusion_from_outside_target; |
| 30 } | 28 } |
| 31 | 29 |
| 32 void set_occlusion_from_outside_target(const Region& region) { | 30 void set_occlusion_from_outside_target(const Region& region) { |
| 33 OcclusionTracker<LayerType>::stack_.back().occlusion_from_outside_target = | 31 OcclusionTracker<LayerType>::stack_.back().occlusion_from_outside_target = |
| 34 region; | 32 region; |
| 35 } | 33 } |
| 36 void set_occlusion_from_inside_target(const Region& region) { | 34 void set_occlusion_from_inside_target(const Region& region) { |
| 37 OcclusionTracker<LayerType>::stack_.back().occlusion_from_inside_target = | 35 OcclusionTracker<LayerType>::stack_.back().occlusion_from_inside_target = |
| 38 region; | 36 region; |
| 39 } | 37 } |
| 40 }; | 38 }; |
| 41 | 39 |
| 42 } // namespace cc | 40 } // namespace cc |
| 43 | 41 |
| 44 #endif // CC_TEST_TEST_OCCLUSION_TRACKER_H_ | 42 #endif // CC_TEST_TEST_OCCLUSION_TRACKER_H_ |
| OLD | NEW |