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/buffer_types.h" |
13 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
14 #include "ui/gfx/geometry/rect_f.h" | 15 #include "ui/gfx/geometry/rect_f.h" |
15 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
16 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/gfx/overlay_transform.h" | 18 #include "ui/gfx/overlay_transform.h" |
18 #include "ui/gfx/swap_result.h" | 19 #include "ui/gfx/swap_result.h" |
19 #include "ui/gl/gl_export.h" | 20 #include "ui/gl/gl_export.h" |
20 #include "ui/gl/gl_implementation.h" | 21 #include "ui/gl/gl_implementation.h" |
21 | 22 |
22 namespace gl { | 23 namespace gl { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // of screen refresh. If unavailable, returns NULL. | 148 // of screen refresh. If unavailable, returns NULL. |
148 virtual VSyncProvider* GetVSyncProvider(); | 149 virtual VSyncProvider* GetVSyncProvider(); |
149 | 150 |
150 // Schedule an overlay plane to be shown at swap time, or on the next | 151 // Schedule an overlay plane to be shown at swap time, or on the next |
151 // CommitOverlayPlanes call. | 152 // CommitOverlayPlanes call. |
152 // |z_order| specifies the stacking order of the plane relative to the | 153 // |z_order| specifies the stacking order of the plane relative to the |
153 // main framebuffer located at index 0. For the case where there is no | 154 // main framebuffer located at index 0. For the case where there is no |
154 // main framebuffer, overlays may be scheduled at 0, taking its place. | 155 // main framebuffer, overlays may be scheduled at 0, taking its place. |
155 // |transform| specifies how the buffer is to be transformed during | 156 // |transform| specifies how the buffer is to be transformed during |
156 // composition. | 157 // composition. |
| 158 // |storage_format| gives a hint about the optimal storage format supported |
| 159 // by the platform for this overlay plane. This can be used to process native |
| 160 // pixmap and store pixel data in that format before scheduling the overlay |
| 161 // plane. |
157 // |image| to be presented by the overlay. | 162 // |image| to be presented by the overlay. |
158 // |bounds_rect| specify where it is supposed to be on the screen in pixels. | 163 // |bounds_rect| specify where it is supposed to be on the screen in pixels. |
159 // |crop_rect| specifies the region within the buffer to be placed inside | 164 // |crop_rect| specifies the region within the buffer to be placed inside |
160 // |bounds_rect|. | 165 // |bounds_rect|. |
| 166 // |handle_scaling| hints if surface needs to handle any required scaling |
| 167 // before scheduling the plane. The value is set to true if scaling needs to |
| 168 // be handled by the surface. |
161 virtual bool ScheduleOverlayPlane(int z_order, | 169 virtual bool ScheduleOverlayPlane(int z_order, |
162 OverlayTransform transform, | 170 OverlayTransform transform, |
| 171 gfx::BufferFormat storage_format, |
163 gl::GLImage* image, | 172 gl::GLImage* image, |
164 const Rect& bounds_rect, | 173 const Rect& bounds_rect, |
165 const RectF& crop_rect); | 174 const RectF& crop_rect, |
| 175 bool handle_scaling); |
166 | 176 |
167 // Schedule a CALayer to be shown at swap time. | 177 // Schedule a CALayer to be shown at swap time. |
168 // All arguments correspond to their CALayer properties. | 178 // All arguments correspond to their CALayer properties. |
169 virtual bool ScheduleCALayer(gl::GLImage* contents_image, | 179 virtual bool ScheduleCALayer(gl::GLImage* contents_image, |
170 const RectF& contents_rect, | 180 const RectF& contents_rect, |
171 float opacity, | 181 float opacity, |
172 unsigned background_color, | 182 unsigned background_color, |
173 const SizeF& size, | 183 const SizeF& size, |
174 const Transform& transform); | 184 const Transform& transform); |
175 | 185 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 bool OnMakeCurrent(GLContext* context) override; | 258 bool OnMakeCurrent(GLContext* context) override; |
249 bool SetBackbufferAllocation(bool allocated) override; | 259 bool SetBackbufferAllocation(bool allocated) override; |
250 void SetFrontbufferAllocation(bool allocated) override; | 260 void SetFrontbufferAllocation(bool allocated) override; |
251 void* GetShareHandle() override; | 261 void* GetShareHandle() override; |
252 void* GetDisplay() override; | 262 void* GetDisplay() override; |
253 void* GetConfig() override; | 263 void* GetConfig() override; |
254 unsigned GetFormat() override; | 264 unsigned GetFormat() override; |
255 VSyncProvider* GetVSyncProvider() override; | 265 VSyncProvider* GetVSyncProvider() override; |
256 bool ScheduleOverlayPlane(int z_order, | 266 bool ScheduleOverlayPlane(int z_order, |
257 OverlayTransform transform, | 267 OverlayTransform transform, |
| 268 gfx::BufferFormat storage_format, |
258 gl::GLImage* image, | 269 gl::GLImage* image, |
259 const Rect& bounds_rect, | 270 const Rect& bounds_rect, |
260 const RectF& crop_rect) override; | 271 const RectF& crop_rect, |
| 272 bool handle_scaling) override; |
261 bool IsSurfaceless() const override; | 273 bool IsSurfaceless() const override; |
262 | 274 |
263 GLSurface* surface() const { return surface_.get(); } | 275 GLSurface* surface() const { return surface_.get(); } |
264 | 276 |
265 protected: | 277 protected: |
266 ~GLSurfaceAdapter() override; | 278 ~GLSurfaceAdapter() override; |
267 | 279 |
268 private: | 280 private: |
269 scoped_refptr<GLSurface> surface_; | 281 scoped_refptr<GLSurface> surface_; |
270 | 282 |
271 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 283 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
272 }; | 284 }; |
273 | 285 |
274 } // namespace gfx | 286 } // namespace gfx |
275 | 287 |
276 #endif // UI_GL_GL_SURFACE_H_ | 288 #endif // UI_GL_GL_SURFACE_H_ |
OLD | NEW |