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/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
13 #include "ui/gfx/overlay_transform.h" | 14 #include "ui/gfx/overlay_transform.h" |
14 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
15 #include "ui/gfx/rect_f.h" | 16 #include "ui/gfx/rect_f.h" |
16 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
17 #include "ui/gl/gl_export.h" | 18 #include "ui/gl/gl_export.h" |
18 #include "ui/gl/gl_implementation.h" | 19 #include "ui/gl/gl_implementation.h" |
19 | 20 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // |crop_rect| specifies the region within the buffer to be placed inside | 122 // |crop_rect| specifies the region within the buffer to be placed inside |
122 // |bounds_rect|. | 123 // |bounds_rect|. |
123 virtual bool ScheduleOverlayPlane(int z_order, | 124 virtual bool ScheduleOverlayPlane(int z_order, |
124 OverlayTransform transform, | 125 OverlayTransform transform, |
125 GLImage* image, | 126 GLImage* image, |
126 const Rect& bounds_rect, | 127 const Rect& bounds_rect, |
127 const RectF& crop_rect); | 128 const RectF& crop_rect); |
128 | 129 |
129 virtual bool IsSurfaceless() const; | 130 virtual bool IsSurfaceless() const; |
130 | 131 |
| 132 typedef base::Callback<void()> |
| 133 PageFlipCompletionCallback; |
| 134 // On platforms where Chromium manages the system front/back buffer, we need |
| 135 // to know when front buffer is actually displayed on screen. This |
| 136 // callback should be called after the front buffer is displayed on screen. |
| 137 virtual void SetPageFlipCompletionCallback( |
| 138 const PageFlipCompletionCallback& callback); |
| 139 |
131 // Create a GL surface that renders directly to a view. | 140 // Create a GL surface that renders directly to a view. |
132 static scoped_refptr<GLSurface> CreateViewGLSurface( | 141 static scoped_refptr<GLSurface> CreateViewGLSurface( |
133 gfx::AcceleratedWidget window); | 142 gfx::AcceleratedWidget window); |
134 | 143 |
135 // Create a GL surface used for offscreen rendering. | 144 // Create a GL surface used for offscreen rendering. |
136 static scoped_refptr<GLSurface> CreateOffscreenGLSurface( | 145 static scoped_refptr<GLSurface> CreateOffscreenGLSurface( |
137 const gfx::Size& size); | 146 const gfx::Size& size); |
138 | 147 |
139 static GLSurface* GetCurrent(); | 148 static GLSurface* GetCurrent(); |
140 | 149 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 void* GetConfig() override; | 191 void* GetConfig() override; |
183 unsigned GetFormat() override; | 192 unsigned GetFormat() override; |
184 VSyncProvider* GetVSyncProvider() override; | 193 VSyncProvider* GetVSyncProvider() override; |
185 bool ScheduleOverlayPlane(int z_order, | 194 bool ScheduleOverlayPlane(int z_order, |
186 OverlayTransform transform, | 195 OverlayTransform transform, |
187 GLImage* image, | 196 GLImage* image, |
188 const Rect& bounds_rect, | 197 const Rect& bounds_rect, |
189 const RectF& crop_rect) override; | 198 const RectF& crop_rect) override; |
190 bool IsSurfaceless() const override; | 199 bool IsSurfaceless() const override; |
191 | 200 |
| 201 void SetPageFlipCompletionCallback( |
| 202 const PageFlipCompletionCallback& callback) override; |
| 203 |
192 GLSurface* surface() const { return surface_.get(); } | 204 GLSurface* surface() const { return surface_.get(); } |
193 | 205 |
194 protected: | 206 protected: |
195 ~GLSurfaceAdapter() override; | 207 ~GLSurfaceAdapter() override; |
196 | 208 |
197 private: | 209 private: |
198 scoped_refptr<GLSurface> surface_; | 210 scoped_refptr<GLSurface> surface_; |
199 | 211 |
200 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 212 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
201 }; | 213 }; |
202 | 214 |
203 } // namespace gfx | 215 } // namespace gfx |
204 | 216 |
205 #endif // UI_GL_GL_SURFACE_H_ | 217 #endif // UI_GL_GL_SURFACE_H_ |
OLD | NEW |