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_LAYER_TREE_IMPL_H_ | 5 #ifndef CC_LAYER_TREE_IMPL_H_ |
6 #define CC_LAYER_TREE_IMPL_H_ | 6 #define CC_LAYER_TREE_IMPL_H_ |
7 | 7 |
8 #include "base/hash_tables.h" | 8 #include "base/hash_tables.h" |
9 #include "cc/layer_impl.h" | 9 #include "cc/layer_impl.h" |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 DebugRectHistory* debug_rect_history() const; | 71 DebugRectHistory* debug_rect_history() const; |
72 const PinchZoomViewport& pinch_zoom_viewport() const; | 72 const PinchZoomViewport& pinch_zoom_viewport() const; |
73 | 73 |
74 // Other public methods | 74 // Other public methods |
75 // --------------------------------------------------------------------------- | 75 // --------------------------------------------------------------------------- |
76 LayerImpl* RootLayer() const { return root_layer_.get(); } | 76 LayerImpl* RootLayer() const { return root_layer_.get(); } |
77 void SetRootLayer(scoped_ptr<LayerImpl>); | 77 void SetRootLayer(scoped_ptr<LayerImpl>); |
78 scoped_ptr<LayerImpl> DetachLayerTree(); | 78 scoped_ptr<LayerImpl> DetachLayerTree(); |
79 | 79 |
80 int source_frame_number() const { return source_frame_number_; } | 80 int source_frame_number() const { return source_frame_number_; } |
81 void set_source_frame_number(int frame_number) { source_frame_number_ = frame_
number; } | 81 void set_source_frame_number(int frame_number) { |
| 82 source_frame_number_ = frame_number; |
| 83 } |
82 | 84 |
83 HeadsUpDisplayLayerImpl* hud_layer() { return hud_layer_; } | 85 HeadsUpDisplayLayerImpl* hud_layer() { return hud_layer_; } |
84 void set_hud_layer(HeadsUpDisplayLayerImpl* layer_impl) { hud_layer_ = layer_i
mpl; } | 86 void set_hud_layer(HeadsUpDisplayLayerImpl* layer_impl) { |
| 87 hud_layer_ = layer_impl; |
| 88 } |
85 | 89 |
86 LayerImpl* root_scroll_layer() { return root_scroll_layer_; } | 90 LayerImpl* root_scroll_layer() { return root_scroll_layer_; } |
87 const LayerImpl* root_scroll_layer() const { return root_scroll_layer_; } | 91 const LayerImpl* root_scroll_layer() const { return root_scroll_layer_; } |
88 void set_root_scroll_layer(LayerImpl* layer_impl) { root_scroll_layer_ = layer
_impl; } | 92 void set_root_scroll_layer(LayerImpl* layer_impl) { |
| 93 root_scroll_layer_ = layer_impl; |
| 94 } |
89 | 95 |
90 LayerImpl* currently_scrolling_layer() { return currently_scrolling_layer_; } | 96 LayerImpl* currently_scrolling_layer() { return currently_scrolling_layer_; } |
91 void set_currently_scrolling_layer(LayerImpl* layer_impl) { currently_scrollin
g_layer_ = layer_impl; } | 97 void set_currently_scrolling_layer(LayerImpl* layer_impl) { |
| 98 currently_scrolling_layer_ = layer_impl; |
| 99 } |
92 | 100 |
93 void ClearCurrentlyScrollingLayer(); | 101 void ClearCurrentlyScrollingLayer(); |
94 | 102 |
95 void UpdateMaxScrollOffset(); | 103 void UpdateMaxScrollOffset(); |
96 | 104 |
| 105 SkColor background_color() const { return background_color_; } |
| 106 void set_background_color(SkColor color) { background_color_ = color; } |
| 107 |
| 108 bool has_transparent_background() const { |
| 109 return has_transparent_background_; |
| 110 } |
| 111 void set_has_transparent_background(bool transparent) { |
| 112 has_transparent_background_ = transparent; |
| 113 } |
| 114 |
97 // Updates draw properties and render surface layer list | 115 // Updates draw properties and render surface layer list |
98 void UpdateDrawProperties(); | 116 void UpdateDrawProperties(); |
99 | 117 |
100 void ClearRenderSurfaces(); | 118 void ClearRenderSurfaces(); |
101 | 119 |
102 const LayerList& RenderSurfaceLayerList() const; | 120 const LayerList& RenderSurfaceLayerList() const; |
103 | 121 |
104 gfx::Size ContentSize() const; | 122 gfx::Size ContentSize() const; |
105 | 123 |
106 LayerImpl* LayerById(int id); | 124 LayerImpl* LayerById(int id); |
107 | 125 |
108 // These should be called by LayerImpl's ctor/dtor. | 126 // These should be called by LayerImpl's ctor/dtor. |
109 void RegisterLayer(LayerImpl* layer); | 127 void RegisterLayer(LayerImpl* layer); |
110 void UnregisterLayer(LayerImpl* layer); | 128 void UnregisterLayer(LayerImpl* layer); |
111 | 129 |
112 AnimationRegistrar* animationRegistrar() const; | 130 AnimationRegistrar* animationRegistrar() const; |
113 | 131 |
114 protected: | 132 protected: |
115 LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); | 133 LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); |
116 | 134 |
117 LayerTreeHostImpl* layer_tree_host_impl_; | 135 LayerTreeHostImpl* layer_tree_host_impl_; |
118 int source_frame_number_; | 136 int source_frame_number_; |
119 scoped_ptr<LayerImpl> root_layer_; | 137 scoped_ptr<LayerImpl> root_layer_; |
120 HeadsUpDisplayLayerImpl* hud_layer_; | 138 HeadsUpDisplayLayerImpl* hud_layer_; |
121 LayerImpl* root_scroll_layer_; | 139 LayerImpl* root_scroll_layer_; |
122 LayerImpl* currently_scrolling_layer_; | 140 LayerImpl* currently_scrolling_layer_; |
| 141 SkColor background_color_; |
| 142 bool has_transparent_background_; |
123 | 143 |
124 typedef base::hash_map<int, LayerImpl*> LayerIdMap; | 144 typedef base::hash_map<int, LayerImpl*> LayerIdMap; |
125 LayerIdMap layer_id_map_; | 145 LayerIdMap layer_id_map_; |
126 | 146 |
127 // Persisted state | 147 // Persisted state |
128 int scrolling_layer_id_from_previous_tree_; | 148 int scrolling_layer_id_from_previous_tree_; |
129 | 149 |
130 // List of visible layers for the most recently prepared frame. Used for | 150 // List of visible layers for the most recently prepared frame. Used for |
131 // rendering and input event hit testing. | 151 // rendering and input event hit testing. |
132 LayerList render_surface_layer_list_; | 152 LayerList render_surface_layer_list_; |
133 | 153 |
134 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 154 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
135 }; | 155 }; |
136 | 156 |
137 } | 157 } |
138 | 158 |
139 #endif // CC_LAYER_TREE_IMPL_H_ | 159 #endif // CC_LAYER_TREE_IMPL_H_ |
OLD | NEW |