| 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 |
| 106 protected: |
| 107 virtual ~Texture(); |
| 108 |
| 107 private: | 109 private: |
| 110 friend class base::RefCounted<Texture>; |
| 111 |
| 108 unsigned int texture_id_; | 112 unsigned int texture_id_; |
| 109 bool flipped_; | 113 bool flipped_; |
| 110 gfx::Size size_; | 114 gfx::Size size_; |
| 111 | 115 |
| 112 DISALLOW_COPY_AND_ASSIGN(Texture); | 116 DISALLOW_COPY_AND_ASSIGN(Texture); |
| 113 }; | 117 }; |
| 114 | 118 |
| 115 // An interface to allow the compositor to communicate with its owner. | 119 // An interface to allow the compositor to communicate with its owner. |
| 116 class COMPOSITOR_EXPORT CompositorDelegate { | 120 class COMPOSITOR_EXPORT CompositorDelegate { |
| 117 public: | 121 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 | 236 // This is set to true when the swap buffers has been posted and we're waiting |
| 233 // for completion. | 237 // for completion. |
| 234 bool swap_posted_; | 238 bool swap_posted_; |
| 235 | 239 |
| 236 friend class base::RefCounted<Compositor>; | 240 friend class base::RefCounted<Compositor>; |
| 237 }; | 241 }; |
| 238 | 242 |
| 239 } // namespace ui | 243 } // namespace ui |
| 240 | 244 |
| 241 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 245 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
| OLD | NEW |