Chromium Code Reviews| 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" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/gfx/geometry/rect_f.h" | 14 #include "ui/gfx/geometry/rect_f.h" |
| 15 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
| 16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 17 #include "ui/gfx/overlay_transform.h" | 17 #include "ui/gfx/overlay_transform.h" |
| 18 #include "ui/gfx/swap_result.h" | 18 #include "ui/gfx/swap_result.h" |
| 19 #include "ui/gl/gl_export.h" | 19 #include "ui/gl/gl_export.h" |
| 20 #include "ui/gl/gl_implementation.h" | 20 #include "ui/gl/gl_implementation.h" |
| 21 | 21 |
| 22 namespace gl { | 22 namespace gl { |
| 23 class GLImage; | 23 class GLImage; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace gfx { | 26 namespace gfx { |
| 27 | 27 |
| 28 class Transform; | |
| 28 class GLContext; | 29 class GLContext; |
| 29 class VSyncProvider; | 30 class VSyncProvider; |
|
Avi (use Gerrit)
2015/11/10 02:25:58
alphabetize?
ccameron
2015/11/10 03:05:06
Done.
| |
| 30 | 31 |
| 31 // Encapsulates a surface that can be rendered to with GL, hiding platform | 32 // Encapsulates a surface that can be rendered to with GL, hiding platform |
| 32 // specific management. | 33 // specific management. |
| 33 class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { | 34 class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { |
| 34 public: | 35 public: |
| 35 GLSurface(); | 36 GLSurface(); |
| 36 | 37 |
| 37 // (Re)create the surface. TODO(apatrick): This is an ugly hack to allow the | 38 // (Re)create the surface. TODO(apatrick): This is an ugly hack to allow the |
| 38 // EGL surface associated to be recreated without destroying the associated | 39 // EGL surface associated to be recreated without destroying the associated |
| 39 // context. The implementation of this function for other GLSurface derived | 40 // context. The implementation of this function for other GLSurface derived |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 // |image| to be presented by the overlay. | 138 // |image| to be presented by the overlay. |
| 138 // |bounds_rect| specify where it is supposed to be on the screen in pixels. | 139 // |bounds_rect| specify where it is supposed to be on the screen in pixels. |
| 139 // |crop_rect| specifies the region within the buffer to be placed inside | 140 // |crop_rect| specifies the region within the buffer to be placed inside |
| 140 // |bounds_rect|. | 141 // |bounds_rect|. |
| 141 virtual bool ScheduleOverlayPlane(int z_order, | 142 virtual bool ScheduleOverlayPlane(int z_order, |
| 142 OverlayTransform transform, | 143 OverlayTransform transform, |
| 143 gl::GLImage* image, | 144 gl::GLImage* image, |
| 144 const Rect& bounds_rect, | 145 const Rect& bounds_rect, |
| 145 const RectF& crop_rect); | 146 const RectF& crop_rect); |
| 146 | 147 |
| 148 // Schedule a CALayer to be shown at swap time. | |
| 149 // All arguments correspond to their CALayer properties. | |
| 150 virtual bool ScheduleCALayer(gl::GLImage* contents_image, | |
| 151 const RectF& contents_rect, | |
| 152 float opacity, | |
| 153 unsigned background_color, | |
| 154 const SizeF& size, | |
| 155 const Transform& transform); | |
| 156 | |
| 147 virtual bool IsSurfaceless() const; | 157 virtual bool IsSurfaceless() const; |
| 148 | 158 |
| 149 // Create a GL surface that renders directly to a view. | 159 // Create a GL surface that renders directly to a view. |
| 150 static scoped_refptr<GLSurface> CreateViewGLSurface( | 160 static scoped_refptr<GLSurface> CreateViewGLSurface( |
| 151 gfx::AcceleratedWidget window); | 161 gfx::AcceleratedWidget window); |
| 152 | 162 |
| 153 #if defined(USE_OZONE) | 163 #if defined(USE_OZONE) |
| 154 // Create a GL surface that renders directly into a window with surfaceless | 164 // Create a GL surface that renders directly into a window with surfaceless |
| 155 // semantics - there is no default framebuffer and the primary surface must | 165 // semantics - there is no default framebuffer and the primary surface must |
| 156 // be presented as an overlay. If surfaceless mode is not supported or | 166 // be presented as an overlay. If surfaceless mode is not supported or |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 | 243 |
| 234 private: | 244 private: |
| 235 scoped_refptr<GLSurface> surface_; | 245 scoped_refptr<GLSurface> surface_; |
| 236 | 246 |
| 237 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 247 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
| 238 }; | 248 }; |
| 239 | 249 |
| 240 } // namespace gfx | 250 } // namespace gfx |
| 241 | 251 |
| 242 #endif // UI_GL_GL_SURFACE_H_ | 252 #endif // UI_GL_GL_SURFACE_H_ |
| OLD | NEW |