Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: ui/gl/gl_surface.h

Issue 1998723002: Move code in ui/gl/* from gfx:: to gl:: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_state_restorer.cc ('k') | ui/gl/gl_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "ui/gfx/geometry/rect.h" 14 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/geometry/rect_f.h" 15 #include "ui/gfx/geometry/rect_f.h"
16 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
17 #include "ui/gfx/native_widget_types.h" 17 #include "ui/gfx/native_widget_types.h"
18 #include "ui/gfx/overlay_transform.h" 18 #include "ui/gfx/overlay_transform.h"
19 #include "ui/gfx/swap_result.h" 19 #include "ui/gfx/swap_result.h"
20 #include "ui/gl/gl_export.h" 20 #include "ui/gl/gl_export.h"
21 #include "ui/gl/gl_implementation.h" 21 #include "ui/gl/gl_implementation.h"
22 22
23 namespace gl { 23 namespace gfx {
24 class GLImage; 24 class Transform;
25 class VSyncProvider;
25 } 26 }
26 27
27 namespace gfx { 28 namespace gl {
28 29
29 class GLContext; 30 class GLContext;
30 class Transform; 31 class GLImage;
31 class VSyncProvider;
32 32
33 // Encapsulates a surface that can be rendered to with GL, hiding platform 33 // Encapsulates a surface that can be rendered to with GL, hiding platform
34 // specific management. 34 // specific management.
35 class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { 35 class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> {
36 public: 36 public:
37 GLSurface(); 37 GLSurface();
38 38
39 // Minimum bit depth of surface. 39 // Minimum bit depth of surface.
40 enum Format { 40 enum Format {
41 SURFACE_ARGB8888, 41 SURFACE_ARGB8888,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // Returns whether or not the surface supports CommitOverlayPlanes. 87 // Returns whether or not the surface supports CommitOverlayPlanes.
88 virtual bool SupportsCommitOverlayPlanes(); 88 virtual bool SupportsCommitOverlayPlanes();
89 89
90 // Returns whether SwapBuffersAsync() is supported. 90 // Returns whether SwapBuffersAsync() is supported.
91 virtual bool SupportsAsyncSwap(); 91 virtual bool SupportsAsyncSwap();
92 92
93 // Returns the internal frame buffer object name if the surface is backed by 93 // Returns the internal frame buffer object name if the surface is backed by
94 // FBO. Otherwise returns 0. 94 // FBO. Otherwise returns 0.
95 virtual unsigned int GetBackingFrameBufferObject(); 95 virtual unsigned int GetBackingFrameBufferObject();
96 96
97 typedef base::Callback<void(SwapResult)> SwapCompletionCallback; 97 typedef base::Callback<void(gfx::SwapResult)> SwapCompletionCallback;
98 // Swaps front and back buffers. This has no effect for off-screen 98 // Swaps front and back buffers. This has no effect for off-screen
99 // contexts. On some platforms, we want to send SwapBufferAck only after the 99 // contexts. On some platforms, we want to send SwapBufferAck only after the
100 // surface is displayed on screen. The callback can be used to delay sending 100 // surface is displayed on screen. The callback can be used to delay sending
101 // SwapBufferAck till that data is available. The callback should be run on 101 // SwapBufferAck till that data is available. The callback should be run on
102 // the calling thread (i.e. same thread SwapBuffersAsync is called) 102 // the calling thread (i.e. same thread SwapBuffersAsync is called)
103 virtual void SwapBuffersAsync(const SwapCompletionCallback& callback); 103 virtual void SwapBuffersAsync(const SwapCompletionCallback& callback);
104 104
105 // Copy part of the backbuffer to the frontbuffer. 105 // Copy part of the backbuffer to the frontbuffer.
106 virtual gfx::SwapResult PostSubBuffer(int x, int y, int width, int height); 106 virtual gfx::SwapResult PostSubBuffer(int x, int y, int width, int height);
107 107
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 virtual void* GetDisplay(); 149 virtual void* GetDisplay();
150 150
151 // Get the platfrom specific configuration for this surface, if available. 151 // Get the platfrom specific configuration for this surface, if available.
152 virtual void* GetConfig(); 152 virtual void* GetConfig();
153 153
154 // Get the GL pixel format of the surface, if available. 154 // Get the GL pixel format of the surface, if available.
155 virtual GLSurface::Format GetFormat(); 155 virtual GLSurface::Format GetFormat();
156 156
157 // Get access to a helper providing time of recent refresh and period 157 // Get access to a helper providing time of recent refresh and period
158 // of screen refresh. If unavailable, returns NULL. 158 // of screen refresh. If unavailable, returns NULL.
159 virtual VSyncProvider* GetVSyncProvider(); 159 virtual gfx::VSyncProvider* GetVSyncProvider();
160 160
161 // Schedule an overlay plane to be shown at swap time, or on the next 161 // Schedule an overlay plane to be shown at swap time, or on the next
162 // CommitOverlayPlanes call. 162 // CommitOverlayPlanes call.
163 // |z_order| specifies the stacking order of the plane relative to the 163 // |z_order| specifies the stacking order of the plane relative to the
164 // main framebuffer located at index 0. For the case where there is no 164 // main framebuffer located at index 0. For the case where there is no
165 // main framebuffer, overlays may be scheduled at 0, taking its place. 165 // main framebuffer, overlays may be scheduled at 0, taking its place.
166 // |transform| specifies how the buffer is to be transformed during 166 // |transform| specifies how the buffer is to be transformed during
167 // composition. 167 // composition.
168 // |image| to be presented by the overlay. 168 // |image| to be presented by the overlay.
169 // |bounds_rect| specify where it is supposed to be on the screen in pixels. 169 // |bounds_rect| specify where it is supposed to be on the screen in pixels.
170 // |crop_rect| specifies the region within the buffer to be placed inside 170 // |crop_rect| specifies the region within the buffer to be placed inside
171 // |bounds_rect|. 171 // |bounds_rect|.
172 virtual bool ScheduleOverlayPlane(int z_order, 172 virtual bool ScheduleOverlayPlane(int z_order,
173 OverlayTransform transform, 173 gfx::OverlayTransform transform,
174 gl::GLImage* image, 174 gl::GLImage* image,
175 const Rect& bounds_rect, 175 const gfx::Rect& bounds_rect,
176 const RectF& crop_rect); 176 const gfx::RectF& crop_rect);
177 177
178 // Schedule a CALayer to be shown at swap time. 178 // Schedule a CALayer to be shown at swap time.
179 // All arguments correspond to their CALayer properties. 179 // All arguments correspond to their CALayer properties.
180 virtual bool ScheduleCALayer(gl::GLImage* contents_image, 180 virtual bool ScheduleCALayer(gl::GLImage* contents_image,
181 const RectF& contents_rect, 181 const gfx::RectF& contents_rect,
182 float opacity, 182 float opacity,
183 unsigned background_color, 183 unsigned background_color,
184 unsigned edge_aa_mask, 184 unsigned edge_aa_mask,
185 const RectF& rect, 185 const gfx::RectF& rect,
186 bool is_clipped, 186 bool is_clipped,
187 const RectF& clip_rect, 187 const gfx::RectF& clip_rect,
188 const Transform& transform, 188 const gfx::Transform& transform,
189 int sorting_content_id, 189 int sorting_content_id,
190 unsigned filter); 190 unsigned filter);
191 191
192 virtual bool IsSurfaceless() const; 192 virtual bool IsSurfaceless() const;
193 193
194 virtual bool FlipsVertically() const; 194 virtual bool FlipsVertically() const;
195 195
196 // Returns true if SwapBuffers or PostSubBuffers causes a flip, such that 196 // Returns true if SwapBuffers or PostSubBuffers causes a flip, such that
197 // the next buffer may be 2 frames old. 197 // the next buffer may be 2 frames old.
198 virtual bool BuffersFlipped() const; 198 virtual bool BuffersFlipped() const;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 gfx::Size GetSize() override; 274 gfx::Size GetSize() override;
275 void* GetHandle() override; 275 void* GetHandle() override;
276 unsigned int GetBackingFrameBufferObject() override; 276 unsigned int GetBackingFrameBufferObject() override;
277 bool OnMakeCurrent(GLContext* context) override; 277 bool OnMakeCurrent(GLContext* context) override;
278 bool SetBackbufferAllocation(bool allocated) override; 278 bool SetBackbufferAllocation(bool allocated) override;
279 void SetFrontbufferAllocation(bool allocated) override; 279 void SetFrontbufferAllocation(bool allocated) override;
280 void* GetShareHandle() override; 280 void* GetShareHandle() override;
281 void* GetDisplay() override; 281 void* GetDisplay() override;
282 void* GetConfig() override; 282 void* GetConfig() override;
283 GLSurface::Format GetFormat() override; 283 GLSurface::Format GetFormat() override;
284 VSyncProvider* GetVSyncProvider() override; 284 gfx::VSyncProvider* GetVSyncProvider() override;
285 bool ScheduleOverlayPlane(int z_order, 285 bool ScheduleOverlayPlane(int z_order,
286 OverlayTransform transform, 286 gfx::OverlayTransform transform,
287 gl::GLImage* image, 287 gl::GLImage* image,
288 const Rect& bounds_rect, 288 const gfx::Rect& bounds_rect,
289 const RectF& crop_rect) override; 289 const gfx::RectF& crop_rect) override;
290 bool IsSurfaceless() const override; 290 bool IsSurfaceless() const override;
291 bool FlipsVertically() const override; 291 bool FlipsVertically() const override;
292 bool BuffersFlipped() const override; 292 bool BuffersFlipped() const override;
293 293
294 GLSurface* surface() const { return surface_.get(); } 294 GLSurface* surface() const { return surface_.get(); }
295 295
296 protected: 296 protected:
297 ~GLSurfaceAdapter() override; 297 ~GLSurfaceAdapter() override;
298 298
299 private: 299 private:
300 scoped_refptr<GLSurface> surface_; 300 scoped_refptr<GLSurface> surface_;
301 301
302 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); 302 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter);
303 }; 303 };
304 304
305 } // namespace gfx 305 } // namespace gl
306 306
307 #endif // UI_GL_GL_SURFACE_H_ 307 #endif // UI_GL_GL_SURFACE_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_state_restorer.cc ('k') | ui/gl/gl_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698