| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_LAYERS_RENDER_SURFACE_IMPL_H_ | 5 #ifndef CC_LAYERS_RENDER_SURFACE_IMPL_H_ |
| 6 #define CC_LAYERS_RENDER_SURFACE_IMPL_H_ | 6 #define CC_LAYERS_RENDER_SURFACE_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
| 14 #include "cc/layers/layer_lists.h" | 14 #include "cc/layers/layer_lists.h" |
| 15 #include "cc/quads/render_pass.h" | 15 #include "cc/quads/render_pass.h" |
| 16 #include "cc/quads/shared_quad_state.h" | 16 #include "cc/quads/shared_quad_state.h" |
| 17 #include "cc/trees/occlusion.h" |
| 17 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
| 18 #include "ui/gfx/geometry/rect_f.h" | 19 #include "ui/gfx/geometry/rect_f.h" |
| 19 #include "ui/gfx/transform.h" | 20 #include "ui/gfx/transform.h" |
| 20 | 21 |
| 21 namespace cc { | 22 namespace cc { |
| 22 | 23 |
| 23 class DamageTracker; | 24 class DamageTracker; |
| 24 class DelegatedRendererLayerImpl; | 25 class DelegatedRendererLayerImpl; |
| 25 template <typename LayerType> | 26 class Occlusion; |
| 26 class OcclusionTracker; | |
| 27 class RenderPassId; | 27 class RenderPassId; |
| 28 class RenderPassSink; | 28 class RenderPassSink; |
| 29 class LayerImpl; | 29 class LayerImpl; |
| 30 template <typename LayerType> | 30 template <typename LayerType> |
| 31 class LayerIterator; | 31 class LayerIterator; |
| 32 | 32 |
| 33 struct AppendQuadsData; | 33 struct AppendQuadsData; |
| 34 | 34 |
| 35 class CC_EXPORT RenderSurfaceImpl { | 35 class CC_EXPORT RenderSurfaceImpl { |
| 36 public: | 36 public: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 53 } | 53 } |
| 54 const RenderSurfaceImpl* nearest_occlusion_immune_ancestor() const { | 54 const RenderSurfaceImpl* nearest_occlusion_immune_ancestor() const { |
| 55 return nearest_occlusion_immune_ancestor_; | 55 return nearest_occlusion_immune_ancestor_; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void SetDrawOpacityIsAnimating(bool draw_opacity_is_animating) { | 58 void SetDrawOpacityIsAnimating(bool draw_opacity_is_animating) { |
| 59 draw_opacity_is_animating_ = draw_opacity_is_animating; | 59 draw_opacity_is_animating_ = draw_opacity_is_animating; |
| 60 } | 60 } |
| 61 bool draw_opacity_is_animating() const { return draw_opacity_is_animating_; } | 61 bool draw_opacity_is_animating() const { return draw_opacity_is_animating_; } |
| 62 | 62 |
| 63 SkColor GetDebugBorderColor() const; |
| 64 SkColor GetReplicaDebugBorderColor() const; |
| 65 |
| 66 float GetDebugBorderWidth() const; |
| 67 float GetReplicaDebugBorderWidth() const; |
| 68 |
| 63 void SetDrawTransform(const gfx::Transform& draw_transform) { | 69 void SetDrawTransform(const gfx::Transform& draw_transform) { |
| 64 draw_transform_ = draw_transform; | 70 draw_transform_ = draw_transform; |
| 65 } | 71 } |
| 66 const gfx::Transform& draw_transform() const { return draw_transform_; } | 72 const gfx::Transform& draw_transform() const { return draw_transform_; } |
| 67 | 73 |
| 68 void SetScreenSpaceTransform(const gfx::Transform& screen_space_transform) { | 74 void SetScreenSpaceTransform(const gfx::Transform& screen_space_transform) { |
| 69 screen_space_transform_ = screen_space_transform; | 75 screen_space_transform_ = screen_space_transform; |
| 70 } | 76 } |
| 71 const gfx::Transform& screen_space_transform() const { | 77 const gfx::Transform& screen_space_transform() const { |
| 72 return screen_space_transform_; | 78 return screen_space_transform_; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 bool contributes_to_drawn_surface() const { | 119 bool contributes_to_drawn_surface() const { |
| 114 return contributes_to_drawn_surface_; | 120 return contributes_to_drawn_surface_; |
| 115 } | 121 } |
| 116 void set_contributes_to_drawn_surface(bool contributes_to_drawn_surface) { | 122 void set_contributes_to_drawn_surface(bool contributes_to_drawn_surface) { |
| 117 contributes_to_drawn_surface_ = contributes_to_drawn_surface; | 123 contributes_to_drawn_surface_ = contributes_to_drawn_surface; |
| 118 } | 124 } |
| 119 | 125 |
| 120 void SetContentRect(const gfx::Rect& content_rect); | 126 void SetContentRect(const gfx::Rect& content_rect); |
| 121 gfx::Rect content_rect() const { return content_rect_; } | 127 gfx::Rect content_rect() const { return content_rect_; } |
| 122 | 128 |
| 129 const Occlusion& occlusion_in_content_space() const { |
| 130 return occlusion_in_content_space_; |
| 131 } |
| 132 void set_occlusion_in_content_space(const Occlusion& occlusion) { |
| 133 occlusion_in_content_space_ = occlusion; |
| 134 } |
| 135 |
| 123 LayerImplList& layer_list() { return layer_list_; } | 136 LayerImplList& layer_list() { return layer_list_; } |
| 124 void AddContributingDelegatedRenderPassLayer(LayerImpl* layer); | 137 void AddContributingDelegatedRenderPassLayer(LayerImpl* layer); |
| 125 void ClearLayerLists(); | 138 void ClearLayerLists(); |
| 126 | 139 |
| 127 int OwningLayerId() const; | 140 int OwningLayerId() const; |
| 128 | 141 |
| 129 void ResetPropertyChangedFlag() { surface_property_changed_ = false; } | 142 void ResetPropertyChangedFlag() { surface_property_changed_ = false; } |
| 130 bool SurfacePropertyChanged() const; | 143 bool SurfacePropertyChanged() const; |
| 131 bool SurfacePropertyChangedOnlyFromDescendant() const; | 144 bool SurfacePropertyChangedOnlyFromDescendant() const; |
| 132 | 145 |
| 133 DamageTracker* damage_tracker() const { return damage_tracker_.get(); } | 146 DamageTracker* damage_tracker() const { return damage_tracker_.get(); } |
| 134 | 147 |
| 135 RenderPassId GetRenderPassId(); | 148 RenderPassId GetRenderPassId(); |
| 136 | 149 |
| 137 void AppendRenderPasses(RenderPassSink* pass_sink); | 150 void AppendRenderPasses(RenderPassSink* pass_sink); |
| 138 void AppendQuads(RenderPass* render_pass, | 151 void AppendQuads(RenderPass* render_pass, |
| 139 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 152 const gfx::Transform& draw_transform, |
| 153 const Occlusion& occlusion_in_content_space, |
| 154 SkColor debug_border_color, |
| 155 float debug_border_width, |
| 156 LayerImpl* mask_layer, |
| 140 AppendQuadsData* append_quads_data, | 157 AppendQuadsData* append_quads_data, |
| 141 bool for_replica, | |
| 142 RenderPassId render_pass_id); | 158 RenderPassId render_pass_id); |
| 143 | 159 |
| 144 private: | 160 private: |
| 145 LayerImpl* owning_layer_; | 161 LayerImpl* owning_layer_; |
| 146 | 162 |
| 147 // Uses this surface's space. | 163 // Uses this surface's space. |
| 148 gfx::Rect content_rect_; | 164 gfx::Rect content_rect_; |
| 149 bool surface_property_changed_ : 1; | 165 bool surface_property_changed_ : 1; |
| 150 bool draw_opacity_is_animating_ : 1; | 166 bool draw_opacity_is_animating_ : 1; |
| 151 bool target_surface_transforms_are_animating_ : 1; | 167 bool target_surface_transforms_are_animating_ : 1; |
| 152 bool screen_space_transforms_are_animating_ : 1; | 168 bool screen_space_transforms_are_animating_ : 1; |
| 153 | 169 |
| 154 bool is_clipped_ : 1; | 170 bool is_clipped_ : 1; |
| 155 bool contributes_to_drawn_surface_ : 1; | 171 bool contributes_to_drawn_surface_ : 1; |
| 156 | 172 |
| 157 float draw_opacity_; | 173 float draw_opacity_; |
| 158 gfx::Transform draw_transform_; | 174 gfx::Transform draw_transform_; |
| 159 gfx::Transform screen_space_transform_; | 175 gfx::Transform screen_space_transform_; |
| 160 gfx::Transform replica_draw_transform_; | 176 gfx::Transform replica_draw_transform_; |
| 161 gfx::Transform replica_screen_space_transform_; | 177 gfx::Transform replica_screen_space_transform_; |
| 162 | 178 |
| 163 // Uses the space of the surface's target surface. | 179 // Uses the space of the surface's target surface. |
| 164 gfx::Rect clip_rect_; | 180 gfx::Rect clip_rect_; |
| 165 | 181 |
| 166 LayerImplList layer_list_; | 182 LayerImplList layer_list_; |
| 167 std::vector<DelegatedRendererLayerImpl*> | 183 std::vector<DelegatedRendererLayerImpl*> |
| 168 contributing_delegated_render_pass_layer_list_; | 184 contributing_delegated_render_pass_layer_list_; |
| 185 Occlusion occlusion_in_content_space_; |
| 169 | 186 |
| 170 // The nearest ancestor target surface that will contain the contents of this | 187 // The nearest ancestor target surface that will contain the contents of this |
| 171 // surface, and that ignores outside occlusion. This can point to itself. | 188 // surface, and that ignores outside occlusion. This can point to itself. |
| 172 RenderSurfaceImpl* nearest_occlusion_immune_ancestor_; | 189 RenderSurfaceImpl* nearest_occlusion_immune_ancestor_; |
| 173 | 190 |
| 174 scoped_ptr<DamageTracker> damage_tracker_; | 191 scoped_ptr<DamageTracker> damage_tracker_; |
| 175 | 192 |
| 176 // For LayerIteratorActions | 193 // For LayerIteratorActions |
| 177 int target_render_surface_layer_index_history_; | 194 int target_render_surface_layer_index_history_; |
| 178 int current_layer_index_history_; | 195 int current_layer_index_history_; |
| 179 | 196 |
| 180 friend class LayerIterator<LayerImpl>; | 197 friend class LayerIterator<LayerImpl>; |
| 181 | 198 |
| 182 DISALLOW_COPY_AND_ASSIGN(RenderSurfaceImpl); | 199 DISALLOW_COPY_AND_ASSIGN(RenderSurfaceImpl); |
| 183 }; | 200 }; |
| 184 | 201 |
| 185 } // namespace cc | 202 } // namespace cc |
| 186 #endif // CC_LAYERS_RENDER_SURFACE_IMPL_H_ | 203 #endif // CC_LAYERS_RENDER_SURFACE_IMPL_H_ |
| OLD | NEW |