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/callback.h" | 10 #include "base/callback.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // (Re)create the surface. TODO(apatrick): This is an ugly hack to allow the | 34 // (Re)create the surface. TODO(apatrick): This is an ugly hack to allow the |
35 // EGL surface associated to be recreated without destroying the associated | 35 // EGL surface associated to be recreated without destroying the associated |
36 // context. The implementation of this function for other GLSurface derived | 36 // context. The implementation of this function for other GLSurface derived |
37 // classes is in a pending changelist. | 37 // classes is in a pending changelist. |
38 virtual bool Initialize(); | 38 virtual bool Initialize(); |
39 | 39 |
40 // Destroys the surface. | 40 // Destroys the surface. |
41 virtual void Destroy() = 0; | 41 virtual void Destroy() = 0; |
42 | 42 |
43 virtual bool Resize(const gfx::Size& size); | 43 virtual bool Resize(const gfx::Size& size, float scale_factor); |
44 | 44 |
45 // Recreate the surface without changing the size. | 45 // Recreate the surface without changing the size. |
46 virtual bool Recreate(); | 46 virtual bool Recreate(); |
47 | 47 |
48 // Unschedule the GpuScheduler and return true to abort the processing of | 48 // Unschedule the GpuScheduler and return true to abort the processing of |
49 // a GL draw call to this surface and defer it until the GpuScheduler is | 49 // a GL draw call to this surface and defer it until the GpuScheduler is |
50 // rescheduled. | 50 // rescheduled. |
51 virtual bool DeferDraws(); | 51 virtual bool DeferDraws(); |
52 | 52 |
53 // Returns true if this surface is offscreen. | 53 // Returns true if this surface is offscreen. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 }; | 185 }; |
186 | 186 |
187 // Implementation of GLSurface that forwards all calls through to another | 187 // Implementation of GLSurface that forwards all calls through to another |
188 // GLSurface. | 188 // GLSurface. |
189 class GL_EXPORT GLSurfaceAdapter : public GLSurface { | 189 class GL_EXPORT GLSurfaceAdapter : public GLSurface { |
190 public: | 190 public: |
191 explicit GLSurfaceAdapter(GLSurface* surface); | 191 explicit GLSurfaceAdapter(GLSurface* surface); |
192 | 192 |
193 bool Initialize() override; | 193 bool Initialize() override; |
194 void Destroy() override; | 194 void Destroy() override; |
195 bool Resize(const gfx::Size& size) override; | 195 bool Resize(const gfx::Size& size, float scale_factor) override; |
196 bool Recreate() override; | 196 bool Recreate() override; |
197 bool DeferDraws() override; | 197 bool DeferDraws() override; |
198 bool IsOffscreen() override; | 198 bool IsOffscreen() override; |
199 gfx::SwapResult SwapBuffers() override; | 199 gfx::SwapResult SwapBuffers() override; |
200 bool SwapBuffersAsync(const SwapCompletionCallback& callback) override; | 200 bool SwapBuffersAsync(const SwapCompletionCallback& callback) override; |
201 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | 201 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
202 bool PostSubBufferAsync(int x, | 202 bool PostSubBufferAsync(int x, |
203 int y, | 203 int y, |
204 int width, | 204 int width, |
205 int height, | 205 int height, |
(...skipping 24 matching lines...) Expand all Loading... |
230 | 230 |
231 private: | 231 private: |
232 scoped_refptr<GLSurface> surface_; | 232 scoped_refptr<GLSurface> surface_; |
233 | 233 |
234 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 234 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
235 }; | 235 }; |
236 | 236 |
237 } // namespace gfx | 237 } // namespace gfx |
238 | 238 |
239 #endif // UI_GL_GL_SURFACE_H_ | 239 #endif // UI_GL_GL_SURFACE_H_ |
OLD | NEW |