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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 // Notifies the compositor that compositing is about to start. | 176 // Notifies the compositor that compositing is about to start. |
177 virtual void OnNotifyStart(bool clear) = 0; | 177 virtual void OnNotifyStart(bool clear) = 0; |
178 | 178 |
179 // Notifies the compositor that compositing is complete. | 179 // Notifies the compositor that compositing is complete. |
180 virtual void OnNotifyEnd() = 0; | 180 virtual void OnNotifyEnd() = 0; |
181 | 181 |
182 virtual void OnWidgetSizeChanged() = 0; | 182 virtual void OnWidgetSizeChanged() = 0; |
183 virtual void OnRootLayerChanged(); | 183 virtual void OnRootLayerChanged(); |
184 virtual void DrawTree(); | 184 virtual void DrawTree(); |
| 185 virtual bool CompositesAsynchronously(); |
185 | 186 |
186 CompositorDelegate* delegate() { return delegate_; } | 187 CompositorDelegate* delegate() { return delegate_; } |
187 | 188 |
188 // When reading back pixel data we often get RGBA rather than BGRA pixels and | 189 // When reading back pixel data we often get RGBA rather than BGRA pixels and |
189 // and the image often needs to be flipped vertically. | 190 // and the image often needs to be flipped vertically. |
190 static void SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, | 191 static void SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, |
191 const gfx::Size& image_size); | 192 const gfx::Size& image_size); |
192 | 193 |
| 194 // Notifies the compositor that compositing is complete. |
| 195 void NotifyEnd(); |
| 196 |
193 private: | 197 private: |
194 // Notifies the compositor that compositing is about to start. See Draw() for | 198 // Notifies the compositor that compositing is about to start. See Draw() for |
195 // notes about |force_clear|. | 199 // notes about |force_clear|. |
196 void NotifyStart(bool force_clear); | 200 void NotifyStart(bool force_clear); |
197 | 201 |
198 // Notifies the compositor that compositing is complete. | |
199 void NotifyEnd(); | |
200 | |
201 CompositorDelegate* delegate_; | 202 CompositorDelegate* delegate_; |
202 gfx::Size size_; | 203 gfx::Size size_; |
203 | 204 |
204 // The root of the Layer tree drawn by this compositor. | 205 // The root of the Layer tree drawn by this compositor. |
205 Layer* root_layer_; | 206 Layer* root_layer_; |
206 | 207 |
207 ObserverList<CompositorObserver> observer_list_; | 208 ObserverList<CompositorObserver> observer_list_; |
208 | 209 |
209 // Factory used to create Compositors. Settable by tests. | 210 // Factory used to create Compositors. Settable by tests. |
210 // The delegate can be NULL if you don't wish to catch the ScheduleDraw() | 211 // The delegate can be NULL if you don't wish to catch the ScheduleDraw() |
211 // calls to it. | 212 // calls to it. |
212 static ui::Compositor*(*compositor_factory_)( | 213 static ui::Compositor*(*compositor_factory_)( |
213 ui::CompositorDelegate* delegate); | 214 ui::CompositorDelegate* delegate); |
214 | 215 |
215 friend class base::RefCounted<Compositor>; | 216 friend class base::RefCounted<Compositor>; |
216 }; | 217 }; |
217 | 218 |
218 } // namespace ui | 219 } // namespace ui |
219 | 220 |
220 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 221 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |