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_GL_GL_SURFACE_H_ | 5 #ifndef UI_GL_GL_SURFACE_H_ |
6 #define UI_GL_GL_SURFACE_H_ | 6 #define UI_GL_GL_SURFACE_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 "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 // Copy part of the backbuffer to the frontbuffer. | 65 // Copy part of the backbuffer to the frontbuffer. |
66 virtual bool PostSubBuffer(int x, int y, int width, int height); | 66 virtual bool PostSubBuffer(int x, int y, int width, int height); |
67 | 67 |
68 static bool InitializeOneOff(); | 68 static bool InitializeOneOff(); |
69 | 69 |
70 // Called after a context is made current with this surface. Returns false | 70 // Called after a context is made current with this surface. Returns false |
71 // on error. | 71 // on error. |
72 virtual bool OnMakeCurrent(GLContext* context); | 72 virtual bool OnMakeCurrent(GLContext* context); |
73 | 73 |
74 // Used for explicit buffer management. Expect buffers to be destroyed only | 74 // Used for explicit buffer management. |
75 // when surface is not visible. | 75 virtual void SetBackbufferAllocation(bool allocated); |
76 enum BufferAllocationState { | 76 virtual void SetFrontbufferAllocation(bool allocated); |
77 BUFFER_ALLOCATION_FRONT_AND_BACK, | |
78 BUFFER_ALLOCATION_FRONT_ONLY, | |
79 BUFFER_ALLOCATION_NONE | |
80 }; | |
81 virtual void SetBufferAllocation(BufferAllocationState state); | |
82 | 77 |
83 // Get a handle used to share the surface with another process. Returns null | 78 // Get a handle used to share the surface with another process. Returns null |
84 // if this is not possible. | 79 // if this is not possible. |
85 virtual void* GetShareHandle(); | 80 virtual void* GetShareHandle(); |
86 | 81 |
87 // Get the platform specific display on which this surface resides, if | 82 // Get the platform specific display on which this surface resides, if |
88 // available. | 83 // available. |
89 virtual void* GetDisplay(); | 84 virtual void* GetDisplay(); |
90 | 85 |
91 // Get the platfrom specific configuration for this surface, if available. | 86 // Get the platfrom specific configuration for this surface, if available. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 virtual void Destroy() OVERRIDE; | 123 virtual void Destroy() OVERRIDE; |
129 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 124 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
130 virtual bool IsOffscreen() OVERRIDE; | 125 virtual bool IsOffscreen() OVERRIDE; |
131 virtual bool SwapBuffers() OVERRIDE; | 126 virtual bool SwapBuffers() OVERRIDE; |
132 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 127 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
133 virtual std::string GetExtensions() OVERRIDE; | 128 virtual std::string GetExtensions() OVERRIDE; |
134 virtual gfx::Size GetSize() OVERRIDE; | 129 virtual gfx::Size GetSize() OVERRIDE; |
135 virtual void* GetHandle() OVERRIDE; | 130 virtual void* GetHandle() OVERRIDE; |
136 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 131 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
137 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; | 132 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; |
138 virtual void SetBufferAllocation(BufferAllocationState state) OVERRIDE; | 133 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; |
| 134 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
139 virtual void* GetShareHandle() OVERRIDE; | 135 virtual void* GetShareHandle() OVERRIDE; |
140 virtual void* GetDisplay() OVERRIDE; | 136 virtual void* GetDisplay() OVERRIDE; |
141 virtual void* GetConfig() OVERRIDE; | 137 virtual void* GetConfig() OVERRIDE; |
142 virtual unsigned GetFormat() OVERRIDE; | 138 virtual unsigned GetFormat() OVERRIDE; |
143 | 139 |
144 GLSurface* surface() const { return surface_.get(); } | 140 GLSurface* surface() const { return surface_.get(); } |
145 | 141 |
146 protected: | 142 protected: |
147 virtual ~GLSurfaceAdapter(); | 143 virtual ~GLSurfaceAdapter(); |
148 | 144 |
149 private: | 145 private: |
150 scoped_refptr<GLSurface> surface_; | 146 scoped_refptr<GLSurface> surface_; |
151 | 147 |
152 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 148 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
153 }; | 149 }; |
154 | 150 |
155 } // namespace gfx | 151 } // namespace gfx |
156 | 152 |
157 #endif // UI_GL_GL_SURFACE_H_ | 153 #endif // UI_GL_GL_SURFACE_H_ |
OLD | NEW |