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