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_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/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 namespace ui { | 31 namespace ui { |
32 | 32 |
33 class Compositor; | 33 class Compositor; |
34 class CompositorObserver; | 34 class CompositorObserver; |
35 class Layer; | 35 class Layer; |
36 | 36 |
37 // This class abstracts the creation of the 3D context for the compositor. It is | 37 // This class abstracts the creation of the 3D context for the compositor. It is |
38 // a global object. | 38 // a global object. |
39 class COMPOSITOR_EXPORT ContextFactory { | 39 class COMPOSITOR_EXPORT ContextFactory { |
40 public: | 40 public: |
41 virtual ~ContextFactory() { } | 41 virtual ~ContextFactory() {} |
42 | 42 |
43 // Gets the global instance. | 43 // Gets the global instance. |
44 static ContextFactory* GetInstance(); | 44 static ContextFactory* GetInstance(); |
45 | 45 |
46 // Sets the global instance. Caller keeps ownership. | 46 // Sets the global instance. Caller keeps ownership. |
47 // If this function isn't called (for tests), a "default" factory will be | 47 // If this function isn't called (for tests), a "default" factory will be |
48 // created on the first call of GetInstance. | 48 // created on the first call of GetInstance. |
49 static void SetInstance(ContextFactory* instance); | 49 static void SetInstance(ContextFactory* instance); |
50 | 50 |
51 // Creates a context for given compositor. The factory may keep per-compositor | 51 // Creates a context for given compositor. The factory may keep per-compositor |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 scoped_refptr<gfx::GLShareGroup> share_group_; | 90 scoped_refptr<gfx::GLShareGroup> share_group_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(DefaultContextFactory); | 92 DISALLOW_COPY_AND_ASSIGN(DefaultContextFactory); |
93 }; | 93 }; |
94 | 94 |
95 // Texture provide an abstraction over the external texture that can be passed | 95 // Texture provide an abstraction over the external texture that can be passed |
96 // to a layer. | 96 // to a layer. |
97 class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { | 97 class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { |
98 public: | 98 public: |
99 Texture(bool flipped, const gfx::Size& size); | 99 Texture(bool flipped, const gfx::Size& size); |
100 virtual ~Texture(); | |
101 | 100 |
102 unsigned int texture_id() const { return texture_id_; } | 101 unsigned int texture_id() const { return texture_id_; } |
103 void set_texture_id(unsigned int id) { texture_id_ = id; } | 102 void set_texture_id(unsigned int id) { texture_id_ = id; } |
104 bool flipped() const { return flipped_; } | 103 bool flipped() const { return flipped_; } |
105 gfx::Size size() const { return size_; } | 104 gfx::Size size() const { return size_; } |
106 | 105 |
107 private: | 106 private: |
107 friend class base::RefCounted<Texture>; | |
108 ~Texture(); | |
piman
2012/04/30 17:08:05
needs to stay virtual+protected, the class is exte
Ryan Sleevi
2012/04/30 17:12:59
Done.
| |
109 | |
108 unsigned int texture_id_; | 110 unsigned int texture_id_; |
109 bool flipped_; | 111 bool flipped_; |
110 gfx::Size size_; | 112 gfx::Size size_; |
111 | 113 |
112 DISALLOW_COPY_AND_ASSIGN(Texture); | 114 DISALLOW_COPY_AND_ASSIGN(Texture); |
113 }; | 115 }; |
114 | 116 |
115 // An interface to allow the compositor to communicate with its owner. | 117 // An interface to allow the compositor to communicate with its owner. |
116 class COMPOSITOR_EXPORT CompositorDelegate { | 118 class COMPOSITOR_EXPORT CompositorDelegate { |
117 public: | 119 public: |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 // This is set to true when the swap buffers has been posted and we're waiting | 234 // This is set to true when the swap buffers has been posted and we're waiting |
233 // for completion. | 235 // for completion. |
234 bool swap_posted_; | 236 bool swap_posted_; |
235 | 237 |
236 friend class base::RefCounted<Compositor>; | 238 friend class base::RefCounted<Compositor>; |
237 }; | 239 }; |
238 | 240 |
239 } // namespace ui | 241 } // namespace ui |
240 | 242 |
241 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 243 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |