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 // Graphics Resource Usage |
| 75 enum ResourceUsage { |
| 76 RESOURCE_USAGE_FULL, |
| 77 RESOURCE_USAGE_LESS, |
| 78 RESOURCE_USAGE_NONE, |
| 79 }; |
| 80 |
74 // This gives a hint as to whether this surface is visible. If it is not | 81 // This gives a hint as to whether this surface is visible. If it is not |
75 // visible, the backing store need not be preserved. | 82 // visible, the backing store need not be preserved. |
76 virtual void SetVisible(bool visible); | 83 virtual void SetResourceUsage(ResourceUsage resourceUsage); |
77 | 84 |
78 // Get a handle used to share the surface with another process. Returns null | 85 // Get a handle used to share the surface with another process. Returns null |
79 // if this is not possible. | 86 // if this is not possible. |
80 virtual void* GetShareHandle(); | 87 virtual void* GetShareHandle(); |
81 | 88 |
82 // Get the platform specific display on which this surface resides, if | 89 // Get the platform specific display on which this surface resides, if |
83 // available. | 90 // available. |
84 virtual void* GetDisplay(); | 91 virtual void* GetDisplay(); |
85 | 92 |
86 // Get the platfrom specific configuration for this surface, if available. | 93 // Get the platfrom specific configuration for this surface, if available. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 virtual void Destroy() OVERRIDE; | 130 virtual void Destroy() OVERRIDE; |
124 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 131 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
125 virtual bool IsOffscreen() OVERRIDE; | 132 virtual bool IsOffscreen() OVERRIDE; |
126 virtual bool SwapBuffers() OVERRIDE; | 133 virtual bool SwapBuffers() OVERRIDE; |
127 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 134 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
128 virtual std::string GetExtensions() OVERRIDE; | 135 virtual std::string GetExtensions() OVERRIDE; |
129 virtual gfx::Size GetSize() OVERRIDE; | 136 virtual gfx::Size GetSize() OVERRIDE; |
130 virtual void* GetHandle() OVERRIDE; | 137 virtual void* GetHandle() OVERRIDE; |
131 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 138 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
132 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; | 139 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; |
133 virtual void SetVisible(bool visible) OVERRIDE; | 140 virtual void SetResourceUsage(ResourceUsage resourceUsage) OVERRIDE; |
134 virtual void* GetShareHandle() OVERRIDE; | 141 virtual void* GetShareHandle() OVERRIDE; |
135 virtual void* GetDisplay() OVERRIDE; | 142 virtual void* GetDisplay() OVERRIDE; |
136 virtual void* GetConfig() OVERRIDE; | 143 virtual void* GetConfig() OVERRIDE; |
137 virtual unsigned GetFormat() OVERRIDE; | 144 virtual unsigned GetFormat() OVERRIDE; |
138 | 145 |
139 GLSurface* surface() const { return surface_.get(); } | 146 GLSurface* surface() const { return surface_.get(); } |
140 | 147 |
141 private: | 148 private: |
142 scoped_refptr<GLSurface> surface_; | 149 scoped_refptr<GLSurface> surface_; |
143 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 150 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
144 }; | 151 }; |
145 | 152 |
146 } // namespace gfx | 153 } // namespace gfx |
147 | 154 |
148 #endif // UI_GFX_GL_GL_SURFACE_H_ | 155 #endif // UI_GFX_GL_GL_SURFACE_H_ |
OLD | NEW |