| 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 // This gives a hint as to whether this surface is visible. If it is not | 74 // Used for explicit buffer management. Expect buffers to be destroyed only |
| 75 // visible, the backing store need not be preserved. | 75 // when surface is not visible. |
| 76 enum VisibilityState { | 76 enum BufferAllocationState { |
| 77 VISIBILITY_STATE_FOREGROUND, | 77 BUFFER_ALLOCATION_FRONT_AND_BACK, |
| 78 VISIBILITY_STATE_BACKGROUND, | 78 BUFFER_ALLOCATION_FRONT_ONLY, |
| 79 VISIBILITY_STATE_HIBERNATED | 79 BUFFER_ALLOCATION_NONE |
| 80 }; | 80 }; |
| 81 virtual void SetVisibility(VisibilityState visibility_state); | 81 virtual void SetBufferAllocation(BufferAllocationState state); |
| 82 | 82 |
| 83 // Get a handle used to share the surface with another process. Returns null | 83 // Get a handle used to share the surface with another process. Returns null |
| 84 // if this is not possible. | 84 // if this is not possible. |
| 85 virtual void* GetShareHandle(); | 85 virtual void* GetShareHandle(); |
| 86 | 86 |
| 87 // Get the platform specific display on which this surface resides, if | 87 // Get the platform specific display on which this surface resides, if |
| 88 // available. | 88 // available. |
| 89 virtual void* GetDisplay(); | 89 virtual void* GetDisplay(); |
| 90 | 90 |
| 91 // Get the platfrom specific configuration for this surface, if available. | 91 // 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; | 128 virtual void Destroy() OVERRIDE; |
| 129 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 129 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
| 130 virtual bool IsOffscreen() OVERRIDE; | 130 virtual bool IsOffscreen() OVERRIDE; |
| 131 virtual bool SwapBuffers() OVERRIDE; | 131 virtual bool SwapBuffers() OVERRIDE; |
| 132 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 132 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
| 133 virtual std::string GetExtensions() OVERRIDE; | 133 virtual std::string GetExtensions() OVERRIDE; |
| 134 virtual gfx::Size GetSize() OVERRIDE; | 134 virtual gfx::Size GetSize() OVERRIDE; |
| 135 virtual void* GetHandle() OVERRIDE; | 135 virtual void* GetHandle() OVERRIDE; |
| 136 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 136 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
| 137 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; | 137 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; |
| 138 virtual void SetVisibility(VisibilityState visibility_state) OVERRIDE; | 138 virtual void SetBufferAllocation(BufferAllocationState state) OVERRIDE; |
| 139 virtual void* GetShareHandle() OVERRIDE; | 139 virtual void* GetShareHandle() OVERRIDE; |
| 140 virtual void* GetDisplay() OVERRIDE; | 140 virtual void* GetDisplay() OVERRIDE; |
| 141 virtual void* GetConfig() OVERRIDE; | 141 virtual void* GetConfig() OVERRIDE; |
| 142 virtual unsigned GetFormat() OVERRIDE; | 142 virtual unsigned GetFormat() OVERRIDE; |
| 143 | 143 |
| 144 GLSurface* surface() const { return surface_.get(); } | 144 GLSurface* surface() const { return surface_.get(); } |
| 145 | 145 |
| 146 private: | 146 private: |
| 147 scoped_refptr<GLSurface> surface_; | 147 scoped_refptr<GLSurface> surface_; |
| 148 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 148 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace gfx | 151 } // namespace gfx |
| 152 | 152 |
| 153 #endif // UI_GFX_GL_GL_SURFACE_H_ | 153 #endif // UI_GFX_GL_GL_SURFACE_H_ |
| OLD | NEW |