| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 208 |
| 209 // Returns true if SwapBuffers or PostSubBuffers causes a flip, such that | 209 // Returns true if SwapBuffers or PostSubBuffers causes a flip, such that |
| 210 // the next buffer may be 2 frames old. | 210 // the next buffer may be 2 frames old. |
| 211 virtual bool BuffersFlipped() const; | 211 virtual bool BuffersFlipped() const; |
| 212 | 212 |
| 213 static GLSurface* GetCurrent(); | 213 static GLSurface* GetCurrent(); |
| 214 | 214 |
| 215 // Called when the swap interval for the associated context changes. | 215 // Called when the swap interval for the associated context changes. |
| 216 virtual void OnSetSwapInterval(int interval); | 216 virtual void OnSetSwapInterval(int interval); |
| 217 | 217 |
| 218 // Returns whether IsertFence() is supported. |
| 219 virtual bool SupportsInsertFence(); |
| 220 |
| 221 // Insert fence and run |callback| when fence has signaled. The callback |
| 222 // should be run on the calling thread (i.e. same thread InsertFence is |
| 223 // called) |
| 224 virtual void InsertFence(const base::Closure& callback); |
| 225 |
| 218 protected: | 226 protected: |
| 219 virtual ~GLSurface(); | 227 virtual ~GLSurface(); |
| 220 | 228 |
| 221 static void SetCurrent(GLSurface* surface); | 229 static void SetCurrent(GLSurface* surface); |
| 222 | 230 |
| 223 static bool ExtensionsContain(const char* extensions, const char* name); | 231 static bool ExtensionsContain(const char* extensions, const char* name); |
| 224 | 232 |
| 225 private: | 233 private: |
| 226 friend class base::RefCounted<GLSurface>; | 234 friend class base::RefCounted<GLSurface>; |
| 227 friend class GLContext; | 235 friend class GLContext; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 GLSurface::Format GetFormat() override; | 283 GLSurface::Format GetFormat() override; |
| 276 gfx::VSyncProvider* GetVSyncProvider() override; | 284 gfx::VSyncProvider* GetVSyncProvider() override; |
| 277 bool ScheduleOverlayPlane(int z_order, | 285 bool ScheduleOverlayPlane(int z_order, |
| 278 gfx::OverlayTransform transform, | 286 gfx::OverlayTransform transform, |
| 279 GLImage* image, | 287 GLImage* image, |
| 280 const gfx::Rect& bounds_rect, | 288 const gfx::Rect& bounds_rect, |
| 281 const gfx::RectF& crop_rect) override; | 289 const gfx::RectF& crop_rect) override; |
| 282 bool IsSurfaceless() const override; | 290 bool IsSurfaceless() const override; |
| 283 bool FlipsVertically() const override; | 291 bool FlipsVertically() const override; |
| 284 bool BuffersFlipped() const override; | 292 bool BuffersFlipped() const override; |
| 293 bool SupportsInsertFence() override; |
| 294 void InsertFence(const base::Closure& callback) override; |
| 285 | 295 |
| 286 GLSurface* surface() const { return surface_.get(); } | 296 GLSurface* surface() const { return surface_.get(); } |
| 287 | 297 |
| 288 protected: | 298 protected: |
| 289 ~GLSurfaceAdapter() override; | 299 ~GLSurfaceAdapter() override; |
| 290 | 300 |
| 291 private: | 301 private: |
| 292 scoped_refptr<GLSurface> surface_; | 302 scoped_refptr<GLSurface> surface_; |
| 293 | 303 |
| 294 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 304 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
| 295 }; | 305 }; |
| 296 | 306 |
| 297 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a | 307 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a |
| 298 // scoped_refptr containing the initialized GLSurface or nullptr if | 308 // scoped_refptr containing the initialized GLSurface or nullptr if |
| 299 // initialization fails. | 309 // initialization fails. |
| 300 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( | 310 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( |
| 301 scoped_refptr<GLSurface> surface); | 311 scoped_refptr<GLSurface> surface); |
| 302 | 312 |
| 303 } // namespace gl | 313 } // namespace gl |
| 304 | 314 |
| 305 #endif // UI_GL_GL_SURFACE_H_ | 315 #endif // UI_GL_GL_SURFACE_H_ |
| OLD | NEW |