| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_TEST_TEST_OCCLUSION_TRACKER_H_ | |
| 6 #define CC_TEST_TEST_OCCLUSION_TRACKER_H_ | |
| 7 | |
| 8 #include "cc/layers/render_surface.h" | |
| 9 #include "cc/layers/render_surface_impl.h" | |
| 10 #include "cc/trees/occlusion_tracker.h" | |
| 11 | |
| 12 namespace cc { | |
| 13 | |
| 14 // A subclass to expose the total current occlusion. | |
| 15 template <typename LayerType> | |
| 16 class TestOcclusionTracker : public OcclusionTracker<LayerType> { | |
| 17 public: | |
| 18 explicit TestOcclusionTracker(const gfx::Rect& screen_scissor_rect) | |
| 19 : OcclusionTracker<LayerType>(screen_scissor_rect) {} | |
| 20 | |
| 21 SimpleEnclosedRegion occlusion_from_inside_target() const { | |
| 22 return OcclusionTracker<LayerType>::stack_.back() | |
| 23 .occlusion_from_inside_target; | |
| 24 } | |
| 25 SimpleEnclosedRegion occlusion_from_outside_target() const { | |
| 26 return OcclusionTracker<LayerType>::stack_.back() | |
| 27 .occlusion_from_outside_target; | |
| 28 } | |
| 29 | |
| 30 SimpleEnclosedRegion occlusion_on_contributing_surface_from_inside_target() | |
| 31 const { | |
| 32 size_t stack_size = OcclusionTracker<LayerType>::stack_.size(); | |
| 33 if (stack_size < 2) | |
| 34 return SimpleEnclosedRegion(); | |
| 35 return OcclusionTracker<LayerType>::stack_[stack_size - 2] | |
| 36 .occlusion_from_inside_target; | |
| 37 } | |
| 38 SimpleEnclosedRegion occlusion_on_contributing_surface_from_outside_target() | |
| 39 const { | |
| 40 size_t stack_size = OcclusionTracker<LayerType>::stack_.size(); | |
| 41 if (stack_size < 2) | |
| 42 return SimpleEnclosedRegion(); | |
| 43 return OcclusionTracker<LayerType>::stack_[stack_size - 2] | |
| 44 .occlusion_from_outside_target; | |
| 45 } | |
| 46 | |
| 47 void set_occlusion_from_outside_target(const SimpleEnclosedRegion& region) { | |
| 48 OcclusionTracker<LayerType>::stack_.back().occlusion_from_outside_target = | |
| 49 region; | |
| 50 } | |
| 51 void set_occlusion_from_inside_target(const SimpleEnclosedRegion& region) { | |
| 52 OcclusionTracker<LayerType>::stack_.back().occlusion_from_inside_target = | |
| 53 region; | |
| 54 } | |
| 55 | |
| 56 void set_occlusion_on_contributing_surface_from_outside_target( | |
| 57 const SimpleEnclosedRegion& region) { | |
| 58 size_t stack_size = OcclusionTracker<LayerType>::stack_.size(); | |
| 59 DCHECK_GE(stack_size, 2u); | |
| 60 OcclusionTracker<LayerType>::stack_[stack_size - 2] | |
| 61 .occlusion_from_outside_target = region; | |
| 62 } | |
| 63 void set_occlusion_on_contributing_surface_from_inside_target( | |
| 64 const SimpleEnclosedRegion& region) { | |
| 65 size_t stack_size = OcclusionTracker<LayerType>::stack_.size(); | |
| 66 DCHECK_GE(stack_size, 2u); | |
| 67 OcclusionTracker<LayerType>::stack_[stack_size - 2] | |
| 68 .occlusion_from_inside_target = region; | |
| 69 } | |
| 70 }; | |
| 71 | |
| 72 } // namespace cc | |
| 73 | |
| 74 #endif // CC_TEST_TEST_OCCLUSION_TRACKER_H_ | |
| OLD | NEW |