OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 5 #ifndef UI_COMPOSITOR_COMPOSITOR_H_ |
6 #define UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 6 #define UI_COMPOSITOR_COMPOSITOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli
ent.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli
ent.h" |
15 #include "ui/gfx/compositor/compositor_export.h" | 15 #include "ui/compositor/compositor_export.h" |
16 #include "ui/gfx/gl/gl_share_group.h" | 16 #include "ui/gfx/gl/gl_share_group.h" |
17 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
18 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
19 #include "ui/gfx/transform.h" | 19 #include "ui/gfx/transform.h" |
20 | 20 |
| 21 class SkBitmap; |
21 | 22 |
22 class SkBitmap; | |
23 namespace gfx { | 23 namespace gfx { |
24 class GLContext; | 24 class GLContext; |
25 class GLSurface; | 25 class GLSurface; |
26 class GLShareGroup; | 26 class GLShareGroup; |
27 class Point; | 27 class Point; |
28 class Rect; | 28 class Rect; |
29 } | 29 } |
30 | 30 |
31 namespace ui { | 31 namespace ui { |
32 | 32 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 virtual void layout(); | 206 virtual void layout(); |
207 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, | 207 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, |
208 float scaleFactor); | 208 float scaleFactor); |
209 virtual WebKit::WebGraphicsContext3D* createContext3D(); | 209 virtual WebKit::WebGraphicsContext3D* createContext3D(); |
210 virtual void didRebindGraphicsContext(bool success); | 210 virtual void didRebindGraphicsContext(bool success); |
211 virtual void didCommitAndDrawFrame(); | 211 virtual void didCommitAndDrawFrame(); |
212 virtual void didCompleteSwapBuffers(); | 212 virtual void didCompleteSwapBuffers(); |
213 virtual void scheduleComposite(); | 213 virtual void scheduleComposite(); |
214 | 214 |
215 private: | 215 private: |
| 216 friend class base::RefCounted<Compositor>; |
| 217 |
216 // When reading back pixel data we often get RGBA rather than BGRA pixels and | 218 // When reading back pixel data we often get RGBA rather than BGRA pixels and |
217 // and the image often needs to be flipped vertically. | 219 // and the image often needs to be flipped vertically. |
218 static void SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, | 220 static void SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, |
219 const gfx::Size& image_size); | 221 const gfx::Size& image_size); |
220 | 222 |
221 // Notifies the compositor that compositing is complete. | 223 // Notifies the compositor that compositing is complete. |
222 void NotifyEnd(); | 224 void NotifyEnd(); |
223 | 225 |
224 CompositorDelegate* delegate_; | 226 CompositorDelegate* delegate_; |
225 gfx::Size size_; | 227 gfx::Size size_; |
226 | 228 |
227 // The root of the Layer tree drawn by this compositor. | 229 // The root of the Layer tree drawn by this compositor. |
228 Layer* root_layer_; | 230 Layer* root_layer_; |
229 | 231 |
230 ObserverList<CompositorObserver> observer_list_; | 232 ObserverList<CompositorObserver> observer_list_; |
231 | 233 |
232 gfx::AcceleratedWidget widget_; | 234 gfx::AcceleratedWidget widget_; |
233 WebKit::WebLayer root_web_layer_; | 235 WebKit::WebLayer root_web_layer_; |
234 WebKit::WebLayerTreeView host_; | 236 WebKit::WebLayerTreeView host_; |
235 | 237 |
236 // This is set to true when the swap buffers has been posted and we're waiting | 238 // This is set to true when the swap buffers has been posted and we're waiting |
237 // for completion. | 239 // for completion. |
238 bool swap_posted_; | 240 bool swap_posted_; |
239 | |
240 friend class base::RefCounted<Compositor>; | |
241 }; | 241 }; |
242 | 242 |
243 } // namespace ui | 243 } // namespace ui |
244 | 244 |
245 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 245 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |