| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // Swaps front and back buffers. This has no effect for off-screen | 50 // Swaps front and back buffers. This has no effect for off-screen |
| 51 // contexts. | 51 // contexts. |
| 52 virtual bool SwapBuffers() = 0; | 52 virtual bool SwapBuffers() = 0; |
| 53 | 53 |
| 54 // Get the size of the surface. | 54 // Get the size of the surface. |
| 55 virtual gfx::Size GetSize() = 0; | 55 virtual gfx::Size GetSize() = 0; |
| 56 | 56 |
| 57 // Get the underlying platform specific surface "handle". | 57 // Get the underlying platform specific surface "handle". |
| 58 virtual void* GetHandle() = 0; | 58 virtual void* GetHandle() = 0; |
| 59 | 59 |
| 60 // Returns space separated list of surface specific extensions. | 60 // Returns whether or not the surface supports PostSubBuffer. |
| 61 // The surface must be current. | 61 virtual bool SupportsPostSubBuffer(); |
| 62 virtual std::string GetExtensions(); | |
| 63 | |
| 64 bool HasExtension(const char* name); | |
| 65 | 62 |
| 66 // Returns the internal frame buffer object name if the surface is backed by | 63 // Returns the internal frame buffer object name if the surface is backed by |
| 67 // FBO. Otherwise returns 0. | 64 // FBO. Otherwise returns 0. |
| 68 virtual unsigned int GetBackingFrameBufferObject(); | 65 virtual unsigned int GetBackingFrameBufferObject(); |
| 69 | 66 |
| 70 // Copy part of the backbuffer to the frontbuffer. | 67 // Copy part of the backbuffer to the frontbuffer. |
| 71 virtual bool PostSubBuffer(int x, int y, int width, int height); | 68 virtual bool PostSubBuffer(int x, int y, int width, int height); |
| 72 | 69 |
| 73 // Initialize GL bindings. | 70 // Initialize GL bindings. |
| 74 static bool InitializeOneOff(); | 71 static bool InitializeOneOff(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 explicit GLSurfaceAdapter(GLSurface* surface); | 137 explicit GLSurfaceAdapter(GLSurface* surface); |
| 141 | 138 |
| 142 virtual bool Initialize() OVERRIDE; | 139 virtual bool Initialize() OVERRIDE; |
| 143 virtual void Destroy() OVERRIDE; | 140 virtual void Destroy() OVERRIDE; |
| 144 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 141 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
| 145 virtual bool Recreate() OVERRIDE; | 142 virtual bool Recreate() OVERRIDE; |
| 146 virtual bool DeferDraws() OVERRIDE; | 143 virtual bool DeferDraws() OVERRIDE; |
| 147 virtual bool IsOffscreen() OVERRIDE; | 144 virtual bool IsOffscreen() OVERRIDE; |
| 148 virtual bool SwapBuffers() OVERRIDE; | 145 virtual bool SwapBuffers() OVERRIDE; |
| 149 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 146 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
| 150 virtual std::string GetExtensions() OVERRIDE; | 147 virtual bool SupportsPostSubBuffer() OVERRIDE; |
| 151 virtual gfx::Size GetSize() OVERRIDE; | 148 virtual gfx::Size GetSize() OVERRIDE; |
| 152 virtual void* GetHandle() OVERRIDE; | 149 virtual void* GetHandle() OVERRIDE; |
| 153 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 150 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
| 154 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; | 151 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; |
| 155 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; | 152 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; |
| 156 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 153 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
| 157 virtual void* GetShareHandle() OVERRIDE; | 154 virtual void* GetShareHandle() OVERRIDE; |
| 158 virtual void* GetDisplay() OVERRIDE; | 155 virtual void* GetDisplay() OVERRIDE; |
| 159 virtual void* GetConfig() OVERRIDE; | 156 virtual void* GetConfig() OVERRIDE; |
| 160 virtual unsigned GetFormat() OVERRIDE; | 157 virtual unsigned GetFormat() OVERRIDE; |
| 161 virtual VSyncProvider* GetVSyncProvider() OVERRIDE; | 158 virtual VSyncProvider* GetVSyncProvider() OVERRIDE; |
| 162 | 159 |
| 163 GLSurface* surface() const { return surface_.get(); } | 160 GLSurface* surface() const { return surface_.get(); } |
| 164 | 161 |
| 165 protected: | 162 protected: |
| 166 virtual ~GLSurfaceAdapter(); | 163 virtual ~GLSurfaceAdapter(); |
| 167 | 164 |
| 168 private: | 165 private: |
| 169 scoped_refptr<GLSurface> surface_; | 166 scoped_refptr<GLSurface> surface_; |
| 170 | 167 |
| 171 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 168 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
| 172 }; | 169 }; |
| 173 | 170 |
| 174 } // namespace gfx | 171 } // namespace gfx |
| 175 | 172 |
| 176 #endif // UI_GL_GL_SURFACE_H_ | 173 #endif // UI_GL_GL_SURFACE_H_ |
| OLD | NEW |