| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 std::vector<CALayerInUseQuery> queries); | 198 std::vector<CALayerInUseQuery> queries); |
| 199 | 199 |
| 200 virtual bool IsSurfaceless() const; | 200 virtual bool IsSurfaceless() const; |
| 201 | 201 |
| 202 virtual bool FlipsVertically() const; | 202 virtual bool FlipsVertically() const; |
| 203 | 203 |
| 204 // Returns true if SwapBuffers or PostSubBuffers causes a flip, such that | 204 // Returns true if SwapBuffers or PostSubBuffers causes a flip, such that |
| 205 // the next buffer may be 2 frames old. | 205 // the next buffer may be 2 frames old. |
| 206 virtual bool BuffersFlipped() const; | 206 virtual bool BuffersFlipped() const; |
| 207 | 207 |
| 208 virtual bool SupportsSetDrawRectangle() const; |
| 209 |
| 210 // Set the rectangle that will be drawn into on the surface. |
| 211 virtual bool SetDrawRectangle(const gfx::Rect& rect); |
| 212 |
| 208 static GLSurface* GetCurrent(); | 213 static GLSurface* GetCurrent(); |
| 209 | 214 |
| 210 // Called when the swap interval for the associated context changes. | 215 // Called when the swap interval for the associated context changes. |
| 211 virtual void OnSetSwapInterval(int interval); | 216 virtual void OnSetSwapInterval(int interval); |
| 212 | 217 |
| 213 protected: | 218 protected: |
| 214 virtual ~GLSurface(); | 219 virtual ~GLSurface(); |
| 215 | 220 |
| 216 static void SetCurrent(GLSurface* surface); | 221 static void SetCurrent(GLSurface* surface); |
| 217 | 222 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 GLSurfaceFormat GetFormat() override; | 275 GLSurfaceFormat GetFormat() override; |
| 271 gfx::VSyncProvider* GetVSyncProvider() override; | 276 gfx::VSyncProvider* GetVSyncProvider() override; |
| 272 bool ScheduleOverlayPlane(int z_order, | 277 bool ScheduleOverlayPlane(int z_order, |
| 273 gfx::OverlayTransform transform, | 278 gfx::OverlayTransform transform, |
| 274 GLImage* image, | 279 GLImage* image, |
| 275 const gfx::Rect& bounds_rect, | 280 const gfx::Rect& bounds_rect, |
| 276 const gfx::RectF& crop_rect) override; | 281 const gfx::RectF& crop_rect) override; |
| 277 bool IsSurfaceless() const override; | 282 bool IsSurfaceless() const override; |
| 278 bool FlipsVertically() const override; | 283 bool FlipsVertically() const override; |
| 279 bool BuffersFlipped() const override; | 284 bool BuffersFlipped() const override; |
| 285 bool SupportsSetDrawRectangle() const override; |
| 286 bool SetDrawRectangle(const gfx::Rect& rect) override; |
| 280 | 287 |
| 281 GLSurface* surface() const { return surface_.get(); } | 288 GLSurface* surface() const { return surface_.get(); } |
| 282 | 289 |
| 283 protected: | 290 protected: |
| 284 ~GLSurfaceAdapter() override; | 291 ~GLSurfaceAdapter() override; |
| 285 | 292 |
| 286 private: | 293 private: |
| 287 scoped_refptr<GLSurface> surface_; | 294 scoped_refptr<GLSurface> surface_; |
| 288 | 295 |
| 289 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 296 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
| 290 }; | 297 }; |
| 291 | 298 |
| 292 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a | 299 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a |
| 293 // scoped_refptr containing the initialized GLSurface or nullptr if | 300 // scoped_refptr containing the initialized GLSurface or nullptr if |
| 294 // initialization fails. | 301 // initialization fails. |
| 295 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( | 302 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( |
| 296 scoped_refptr<GLSurface> surface); | 303 scoped_refptr<GLSurface> surface); |
| 297 | 304 |
| 298 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurfaceWithFormat( | 305 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurfaceWithFormat( |
| 299 scoped_refptr<GLSurface> surface, GLSurfaceFormat format); | 306 scoped_refptr<GLSurface> surface, GLSurfaceFormat format); |
| 300 | 307 |
| 301 } // namespace gl | 308 } // namespace gl |
| 302 | 309 |
| 303 #endif // UI_GL_GL_SURFACE_H_ | 310 #endif // UI_GL_GL_SURFACE_H_ |
| OLD | NEW |