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 3 // found in the LICENSE file. 4 5 #ifndef CC_TEST_OCCLUSION_TRACKER_TEST_COMMON_H_ 6 #define CC_TEST_OCCLUSION_TRACKER_TEST_COMMON_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, typename RenderSurfaceType> 16 class TestOcclusionTrackerBase 17 : public OcclusionTrackerBase<LayerType, RenderSurfaceType> { 18 public: 19 TestOcclusionTrackerBase(gfx::Rect screen_scissor_rect, 20 bool record_metrics_for_frame) 21 : OcclusionTrackerBase<LayerType, RenderSurfaceType>( 22 screen_scissor_rect, 23 record_metrics_for_frame) {} 24 25 Region occlusion_from_inside_target() const { 26 return OcclusionTrackerBase<LayerType, RenderSurfaceType>::stack_.back(). 27 occlusion_from_inside_target; 28 } 29 Region occlusion_from_outside_target() const { 30 return OcclusionTrackerBase<LayerType, RenderSurfaceType>::stack_.back(). 31 occlusion_from_outside_target; 32 } 33 34 void set_occlusion_from_outside_target(const Region& region) { 35 OcclusionTrackerBase<LayerType, RenderSurfaceType>::stack_.back(). 36 occlusion_from_outside_target = region; 37 } 38 void set_occlusion_from_inside_target(const Region& region) { 39 OcclusionTrackerBase<LayerType, RenderSurfaceType>::stack_.back(). 40 occlusion_from_inside_target = region; 41 } 42 }; 43 44 typedef TestOcclusionTrackerBase<Layer, RenderSurface> TestOcclusionTracker; 45 typedef TestOcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> 46 TestOcclusionTrackerImpl; 47 48 } // namespace cc 49 50 #endif // CC_TEST_OCCLUSION_TRACKER_TEST_COMMON_H_ 51