Chromium Code Reviews| 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_GL_H_ | 5 #ifndef UI_GFX_COMPOSITOR_COMPOSITOR_GL_H_ |
| 6 #define UI_GFX_COMPOSITOR_COMPOSITOR_GL_H_ | 6 #define UI_GFX_COMPOSITOR_COMPOSITOR_GL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "ui/gfx/compositor/compositor.h" | 13 #include "ui/gfx/compositor/compositor.h" |
| 14 #include "ui/gfx/gl/scoped_make_current.h" | |
| 14 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
| 15 | 16 |
| 16 namespace gfx { | 17 namespace gfx { |
| 17 class GLContext; | 18 class GLContext; |
| 18 class GLSurface; | 19 class GLSurface; |
| 19 class Rect; | 20 class Rect; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace ui { | 23 namespace ui { |
| 23 | 24 |
| 24 class CompositorGL; | 25 class CompositorGL; |
| 25 class TextureProgramGL; | 26 class TextureProgramGL; |
| 26 | 27 |
| 27 // We share resources (such as shaders) between different Compositors via | 28 // We share resources (such as shaders) between different Compositors via |
| 28 // GLContext sharing so that we only have to create/destroy them once. | 29 // GLContext sharing so that we only have to create/destroy them once. |
| 29 class COMPOSITOR_EXPORT SharedResourcesGL : public SharedResources { | 30 class COMPOSITOR_EXPORT SharedResourcesGL : public SharedResources { |
| 30 public: | 31 public: |
| 31 static SharedResourcesGL* GetInstance(); | 32 static SharedResourcesGL* GetInstance(); |
| 32 | 33 |
| 33 virtual bool MakeSharedContextCurrent(); | 34 virtual bool MakeSharedContextCurrent(); |
| 34 | 35 |
| 36 scoped_refptr<gfx::ScopedMakeCurrent> ScopedMakeCurrent() { | |
|
sky
2011/10/31 20:44:45
Don't inline this.
| |
| 37 return new gfx::ScopedMakeCurrent(context_.get(), surface_.get()); | |
| 38 } | |
| 39 | |
| 35 // Creates a context that shares the resources hosted by this singleton. | 40 // Creates a context that shares the resources hosted by this singleton. |
| 36 scoped_refptr<gfx::GLContext> CreateContext(gfx::GLSurface* surface); | 41 scoped_refptr<gfx::GLContext> CreateContext(gfx::GLSurface* surface); |
| 37 | 42 |
| 38 virtual void* GetDisplay(); | 43 virtual void* GetDisplay(); |
| 39 | 44 |
| 40 ui::TextureProgramGL* program_no_swizzle() { | 45 ui::TextureProgramGL* program_no_swizzle() { |
| 41 return program_no_swizzle_.get(); | 46 return program_no_swizzle_.get(); |
| 42 } | 47 } |
| 43 | 48 |
| 44 ui::TextureProgramGL* program_swizzle() { | 49 ui::TextureProgramGL* program_swizzle() { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 | 124 |
| 120 // Keep track of whether compositing has started or not. | 125 // Keep track of whether compositing has started or not. |
| 121 bool started_; | 126 bool started_; |
| 122 | 127 |
| 123 DISALLOW_COPY_AND_ASSIGN(CompositorGL); | 128 DISALLOW_COPY_AND_ASSIGN(CompositorGL); |
| 124 }; | 129 }; |
| 125 | 130 |
| 126 } // namespace ui | 131 } // namespace ui |
| 127 | 132 |
| 128 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_GL_H_ | 133 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_GL_H_ |
| OLD | NEW |