| 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 #ifndef CC_OCCLUSION_TRACKER_H_ | 5 #ifndef CC_OCCLUSION_TRACKER_H_ |
| 6 #define CC_OCCLUSION_TRACKER_H_ | 6 #define CC_OCCLUSION_TRACKER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/export_template_type.h" |
| 9 #include "cc/cc_export.h" | 10 #include "cc/cc_export.h" |
| 10 #include "cc/layer_iterator.h" | 11 #include "cc/layer_iterator.h" |
| 11 #include "cc/region.h" | 12 #include "cc/region.h" |
| 12 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 class OverdrawMetrics; | 16 class OverdrawMetrics; |
| 16 class LayerImpl; | |
| 17 class RenderSurfaceImpl; | |
| 18 class Layer; | |
| 19 class RenderSurface; | |
| 20 | 17 |
| 21 // This class is used to track occlusion of layers while traversing them in a fr
ont-to-back order. As each layer is visited, one of the | 18 // This class is used to track occlusion of layers while traversing them in a fr
ont-to-back order. As each layer is visited, one of the |
| 22 // methods in this class is called to notify it about the current target surface
. | 19 // methods in this class is called to notify it about the current target surface
. |
| 23 // Then, occlusion in the content space of the current layer may be queried, via
methods such as occluded() and unoccludedContentRect(). | 20 // Then, occlusion in the content space of the current layer may be queried, via
methods such as occluded() and unoccludedContentRect(). |
| 24 // If the current layer owns a RenderSurfaceImpl, then occlusion on that RenderS
urfaceImpl may also be queried via surfaceOccluded() and surfaceUnoccludedConten
tRect(). | 21 // If the current layer owns a RenderSurfaceImpl, then occlusion on that RenderS
urfaceImpl may also be queried via surfaceOccluded() and surfaceUnoccludedConten
tRect(). |
| 25 // Finally, once finished with the layer, occlusion behind the layer should be m
arked by calling markOccludedBehindLayer(). | 22 // Finally, once finished with the layer, occlusion behind the layer should be m
arked by calling markOccludedBehindLayer(). |
| 26 template<typename LayerType, typename RenderSurfaceType> | 23 template<typename LayerType, typename RenderSurfaceType> |
| 27 class CC_EXPORT OcclusionTrackerBase { | 24 class CC_EXPORT OcclusionTrackerBase { |
| 28 public: | 25 public: |
| 29 OcclusionTrackerBase(gfx::Rect screenSpaceClipRect, bool recordMetricsForFra
me); | 26 OcclusionTrackerBase(gfx::Rect screenSpaceClipRect, bool recordMetricsForFra
me); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 scoped_ptr<OverdrawMetrics> m_overdrawMetrics; | 92 scoped_ptr<OverdrawMetrics> m_overdrawMetrics; |
| 96 gfx::Size m_minimumTrackingSize; | 93 gfx::Size m_minimumTrackingSize; |
| 97 | 94 |
| 98 // This is used for visualizing the occlusion tracking process. | 95 // This is used for visualizing the occlusion tracking process. |
| 99 std::vector<gfx::Rect>* m_occludingScreenSpaceRects; | 96 std::vector<gfx::Rect>* m_occludingScreenSpaceRects; |
| 100 std::vector<gfx::Rect>* m_nonOccludingScreenSpaceRects; | 97 std::vector<gfx::Rect>* m_nonOccludingScreenSpaceRects; |
| 101 | 98 |
| 102 DISALLOW_COPY_AND_ASSIGN(OcclusionTrackerBase); | 99 DISALLOW_COPY_AND_ASSIGN(OcclusionTrackerBase); |
| 103 }; | 100 }; |
| 104 | 101 |
| 102 EXPORT_TEMPLATE_TYPE(class, CC_EXPORT, Layer); |
| 103 EXPORT_TEMPLATE_TYPE(class, CC_EXPORT, LayerImpl); |
| 104 EXPORT_TEMPLATE_TYPE(class, CC_EXPORT, RenderSurface); |
| 105 EXPORT_TEMPLATE_TYPE(class, CC_EXPORT, RenderSurfaceImpl); |
| 106 |
| 105 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker; | 107 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker; |
| 106 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; | 108 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; |
| 107 #if !defined(COMPILER_MSVC) | 109 #if !defined(COMPILER_MSVC) |
| 108 extern template class OcclusionTrackerBase<Layer, RenderSurface>; | 110 extern template class OcclusionTrackerBase<Layer, RenderSurface>; |
| 109 extern template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; | 111 extern template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; |
| 110 #endif | 112 #endif |
| 111 | 113 |
| 112 } // namespace cc | 114 } // namespace cc |
| 113 | 115 |
| 114 #endif // CC_OCCLUSION_TRACKER_H_ | 116 #endif // CC_OCCLUSION_TRACKER_H_ |
| OLD | NEW |