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 | 283 |
277 GLSurface* surface() const { return surface_.get(); } | 284 GLSurface* surface() const { return surface_.get(); } |
278 | 285 |
279 protected: | 286 protected: |
280 ~GLSurfaceAdapter() override; | 287 ~GLSurfaceAdapter() override; |
281 | 288 |
282 private: | 289 private: |
283 scoped_refptr<GLSurface> surface_; | 290 scoped_refptr<GLSurface> surface_; |
284 | 291 |
285 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 292 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
286 }; | 293 }; |
287 | 294 |
288 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a | 295 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a |
289 // scoped_refptr containing the initialized GLSurface or nullptr if | 296 // scoped_refptr containing the initialized GLSurface or nullptr if |
290 // initialization fails. | 297 // initialization fails. |
291 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( | 298 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( |
292 scoped_refptr<GLSurface> surface); | 299 scoped_refptr<GLSurface> surface); |
293 | 300 |
294 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurfaceWithFormat( | 301 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurfaceWithFormat( |
295 scoped_refptr<GLSurface> surface, GLSurfaceFormat format); | 302 scoped_refptr<GLSurface> surface, GLSurfaceFormat format); |
296 | 303 |
297 } // namespace gl | 304 } // namespace gl |
298 | 305 |
299 #endif // UI_GL_GL_SURFACE_H_ | 306 #endif // UI_GL_GL_SURFACE_H_ |
OLD | NEW |