| 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_GL_GL_SURFACE_H_ | 5 #ifndef UI_GFX_GL_GL_SURFACE_H_ |
| 6 #define UI_GFX_GL_GL_SURFACE_H_ | 6 #define UI_GFX_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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 virtual void Destroy() OVERRIDE; | 122 virtual void Destroy() OVERRIDE; |
| 128 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 123 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
| 129 virtual bool IsOffscreen() OVERRIDE; | 124 virtual bool IsOffscreen() OVERRIDE; |
| 130 virtual bool SwapBuffers() OVERRIDE; | 125 virtual bool SwapBuffers() OVERRIDE; |
| 131 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 126 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
| 132 virtual std::string GetExtensions() OVERRIDE; | 127 virtual std::string GetExtensions() OVERRIDE; |
| 133 virtual gfx::Size GetSize() OVERRIDE; | 128 virtual gfx::Size GetSize() OVERRIDE; |
| 134 virtual void* GetHandle() OVERRIDE; | 129 virtual void* GetHandle() OVERRIDE; |
| 135 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 130 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
| 136 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; | 131 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; |
| 137 virtual void SetBufferAllocation(BufferAllocationState state) OVERRIDE; | 132 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; |
| 133 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
| 138 virtual void* GetShareHandle() OVERRIDE; | 134 virtual void* GetShareHandle() OVERRIDE; |
| 139 virtual void* GetDisplay() OVERRIDE; | 135 virtual void* GetDisplay() OVERRIDE; |
| 140 virtual void* GetConfig() OVERRIDE; | 136 virtual void* GetConfig() OVERRIDE; |
| 141 virtual unsigned GetFormat() OVERRIDE; | 137 virtual unsigned GetFormat() OVERRIDE; |
| 142 | 138 |
| 143 GLSurface* surface() const { return surface_.get(); } | 139 GLSurface* surface() const { return surface_.get(); } |
| 144 | 140 |
| 145 protected: | 141 protected: |
| 146 virtual ~GLSurfaceAdapter(); | 142 virtual ~GLSurfaceAdapter(); |
| 147 | 143 |
| 148 private: | 144 private: |
| 149 scoped_refptr<GLSurface> surface_; | 145 scoped_refptr<GLSurface> surface_; |
| 150 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 146 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
| 151 }; | 147 }; |
| 152 | 148 |
| 153 } // namespace gfx | 149 } // namespace gfx |
| 154 | 150 |
| 155 #endif // UI_GFX_GL_GL_SURFACE_H_ | 151 #endif // UI_GFX_GL_GL_SURFACE_H_ |
| OLD | NEW |