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 { |
| 23 class GLImage; |
| 24 } |
| 25 |
22 namespace gfx { | 26 namespace gfx { |
23 | 27 |
24 class GLContext; | 28 class GLContext; |
25 class GLImage; | |
26 class VSyncProvider; | 29 class VSyncProvider; |
27 | 30 |
28 // Encapsulates a surface that can be rendered to with GL, hiding platform | 31 // Encapsulates a surface that can be rendered to with GL, hiding platform |
29 // specific management. | 32 // specific management. |
30 class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { | 33 class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { |
31 public: | 34 public: |
32 GLSurface(); | 35 GLSurface(); |
33 | 36 |
34 // (Re)create the surface. TODO(apatrick): This is an ugly hack to allow the | 37 // (Re)create the surface. TODO(apatrick): This is an ugly hack to allow the |
35 // EGL surface associated to be recreated without destroying the associated | 38 // EGL surface associated to be recreated without destroying the associated |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // main framebuffer located at index 0. For the case where there is no | 133 // main framebuffer located at index 0. For the case where there is no |
131 // main framebuffer, overlays may be scheduled at 0, taking its place. | 134 // main framebuffer, overlays may be scheduled at 0, taking its place. |
132 // |transform| specifies how the buffer is to be transformed during | 135 // |transform| specifies how the buffer is to be transformed during |
133 // composition. | 136 // composition. |
134 // |image| to be presented by the overlay. | 137 // |image| to be presented by the overlay. |
135 // |bounds_rect| specify where it is supposed to be on the screen in pixels. | 138 // |bounds_rect| specify where it is supposed to be on the screen in pixels. |
136 // |crop_rect| specifies the region within the buffer to be placed inside | 139 // |crop_rect| specifies the region within the buffer to be placed inside |
137 // |bounds_rect|. | 140 // |bounds_rect|. |
138 virtual bool ScheduleOverlayPlane(int z_order, | 141 virtual bool ScheduleOverlayPlane(int z_order, |
139 OverlayTransform transform, | 142 OverlayTransform transform, |
140 GLImage* image, | 143 gl::GLImage* image, |
141 const Rect& bounds_rect, | 144 const Rect& bounds_rect, |
142 const RectF& crop_rect); | 145 const RectF& crop_rect); |
143 | 146 |
144 virtual bool IsSurfaceless() const; | 147 virtual bool IsSurfaceless() const; |
145 | 148 |
146 // Create a GL surface that renders directly to a view. | 149 // Create a GL surface that renders directly to a view. |
147 static scoped_refptr<GLSurface> CreateViewGLSurface( | 150 static scoped_refptr<GLSurface> CreateViewGLSurface( |
148 gfx::AcceleratedWidget window); | 151 gfx::AcceleratedWidget window); |
149 | 152 |
150 #if defined(USE_OZONE) | 153 #if defined(USE_OZONE) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 bool OnMakeCurrent(GLContext* context) override; | 214 bool OnMakeCurrent(GLContext* context) override; |
212 bool SetBackbufferAllocation(bool allocated) override; | 215 bool SetBackbufferAllocation(bool allocated) override; |
213 void SetFrontbufferAllocation(bool allocated) override; | 216 void SetFrontbufferAllocation(bool allocated) override; |
214 void* GetShareHandle() override; | 217 void* GetShareHandle() override; |
215 void* GetDisplay() override; | 218 void* GetDisplay() override; |
216 void* GetConfig() override; | 219 void* GetConfig() override; |
217 unsigned GetFormat() override; | 220 unsigned GetFormat() override; |
218 VSyncProvider* GetVSyncProvider() override; | 221 VSyncProvider* GetVSyncProvider() override; |
219 bool ScheduleOverlayPlane(int z_order, | 222 bool ScheduleOverlayPlane(int z_order, |
220 OverlayTransform transform, | 223 OverlayTransform transform, |
221 GLImage* image, | 224 gl::GLImage* image, |
222 const Rect& bounds_rect, | 225 const Rect& bounds_rect, |
223 const RectF& crop_rect) override; | 226 const RectF& crop_rect) override; |
224 bool IsSurfaceless() const override; | 227 bool IsSurfaceless() const override; |
225 | 228 |
226 GLSurface* surface() const { return surface_.get(); } | 229 GLSurface* surface() const { return surface_.get(); } |
227 | 230 |
228 protected: | 231 protected: |
229 ~GLSurfaceAdapter() override; | 232 ~GLSurfaceAdapter() override; |
230 | 233 |
231 private: | 234 private: |
232 scoped_refptr<GLSurface> surface_; | 235 scoped_refptr<GLSurface> surface_; |
233 | 236 |
234 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 237 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
235 }; | 238 }; |
236 | 239 |
237 } // namespace gfx | 240 } // namespace gfx |
238 | 241 |
239 #endif // UI_GL_GL_SURFACE_H_ | 242 #endif // UI_GL_GL_SURFACE_H_ |
OLD | NEW |