OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 5 #ifndef UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
6 #define UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 6 #define UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 gfx::AcceleratedWidget widget, | 100 gfx::AcceleratedWidget widget, |
101 const gfx::Size& size); | 101 const gfx::Size& size); |
102 | 102 |
103 // Creates a new texture. The caller owns the returned object. | 103 // Creates a new texture. The caller owns the returned object. |
104 virtual Texture* CreateTexture() = 0; | 104 virtual Texture* CreateTexture() = 0; |
105 | 105 |
106 // Blurs the specific region in the compositor. | 106 // Blurs the specific region in the compositor. |
107 virtual void Blur(const gfx::Rect& bounds) = 0; | 107 virtual void Blur(const gfx::Rect& bounds) = 0; |
108 | 108 |
109 // Schedules a redraw of the layer tree associated with this compositor. | 109 // Schedules a redraw of the layer tree associated with this compositor. |
110 void ScheduleDraw() { | 110 virtual void ScheduleDraw(); |
111 delegate_->ScheduleDraw(); | |
112 } | |
113 | 111 |
114 // Sets the root of the layer tree drawn by this Compositor. | 112 // Sets the root of the layer tree drawn by this Compositor. |
115 // The Compositor does not own the root layer. | 113 // The Compositor does not own the root layer. |
116 Layer* root_layer() { return root_layer_; } | 114 Layer* root_layer() { return root_layer_; } |
117 void SetRootLayer(Layer* root_layer); | 115 void SetRootLayer(Layer* root_layer); |
118 | 116 |
119 // Draws the scene created by the layer tree and any visual effects. If | 117 // Draws the scene created by the layer tree and any visual effects. If |
120 // |force_clear| is true, this will cause the compositor to clear before | 118 // |force_clear| is true, this will cause the compositor to clear before |
121 // compositing. | 119 // compositing. |
122 void Draw(bool force_clear); | 120 void Draw(bool force_clear); |
(...skipping 20 matching lines...) Expand all Loading... |
143 Compositor(CompositorDelegate* delegate, const gfx::Size& size); | 141 Compositor(CompositorDelegate* delegate, const gfx::Size& size); |
144 virtual ~Compositor(); | 142 virtual ~Compositor(); |
145 | 143 |
146 // Notifies the compositor that compositing is about to start. | 144 // Notifies the compositor that compositing is about to start. |
147 virtual void OnNotifyStart(bool clear) = 0; | 145 virtual void OnNotifyStart(bool clear) = 0; |
148 | 146 |
149 // Notifies the compositor that compositing is complete. | 147 // Notifies the compositor that compositing is complete. |
150 virtual void OnNotifyEnd() = 0; | 148 virtual void OnNotifyEnd() = 0; |
151 | 149 |
152 virtual void OnWidgetSizeChanged() = 0; | 150 virtual void OnWidgetSizeChanged() = 0; |
| 151 virtual void OnRootLayerChanged(); |
| 152 virtual void DrawTree(); |
153 | 153 |
154 CompositorDelegate* delegate() { return delegate_; } | 154 CompositorDelegate* delegate() { return delegate_; } |
155 | 155 |
156 private: | 156 private: |
157 // Notifies the compositor that compositing is about to start. See Draw() for | 157 // Notifies the compositor that compositing is about to start. See Draw() for |
158 // notes about |force_clear|. | 158 // notes about |force_clear|. |
159 void NotifyStart(bool force_clear); | 159 void NotifyStart(bool force_clear); |
160 | 160 |
161 // Notifies the compositor that compositing is complete. | 161 // Notifies the compositor that compositing is complete. |
162 void NotifyEnd(); | 162 void NotifyEnd(); |
163 | 163 |
164 CompositorDelegate* delegate_; | 164 CompositorDelegate* delegate_; |
165 gfx::Size size_; | 165 gfx::Size size_; |
166 | 166 |
167 // The root of the Layer tree drawn by this compositor. | 167 // The root of the Layer tree drawn by this compositor. |
168 Layer* root_layer_; | 168 Layer* root_layer_; |
169 | 169 |
170 ObserverList<CompositorObserver> observer_list_; | 170 ObserverList<CompositorObserver> observer_list_; |
171 | 171 |
172 friend class base::RefCounted<Compositor>; | 172 friend class base::RefCounted<Compositor>; |
173 }; | 173 }; |
174 | 174 |
175 } // namespace ui | 175 } // namespace ui |
176 | 176 |
177 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 177 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |