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

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

Issue 2302393002: Support swap damage rect using eglSwapBuffersWithDamageKHR (Closed)
Patch Set: Update GLSurfaceAdapter Created 4 years, 3 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_bindings_autogen_egl.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"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // Swaps front and back buffers. This has no effect for off-screen 78 // Swaps front and back buffers. This has no effect for off-screen
79 // contexts. 79 // contexts.
80 virtual gfx::SwapResult SwapBuffers() = 0; 80 virtual gfx::SwapResult SwapBuffers() = 0;
81 81
82 // Get the size of the surface. 82 // Get the size of the surface.
83 virtual gfx::Size GetSize() = 0; 83 virtual gfx::Size GetSize() = 0;
84 84
85 // Get the underlying platform specific surface "handle". 85 // Get the underlying platform specific surface "handle".
86 virtual void* GetHandle() = 0; 86 virtual void* GetHandle() = 0;
87 87
88 // Returns whether or not the surface supports SwapBuffersWithDamage
89 virtual bool SupportsSwapBuffersWithDamage();
90
88 // Returns whether or not the surface supports PostSubBuffer. 91 // Returns whether or not the surface supports PostSubBuffer.
89 virtual bool SupportsPostSubBuffer(); 92 virtual bool SupportsPostSubBuffer();
90 93
91 // Returns whether or not the surface supports CommitOverlayPlanes. 94 // Returns whether or not the surface supports CommitOverlayPlanes.
92 virtual bool SupportsCommitOverlayPlanes(); 95 virtual bool SupportsCommitOverlayPlanes();
93 96
94 // Returns whether SwapBuffersAsync() is supported. 97 // Returns whether SwapBuffersAsync() is supported.
95 virtual bool SupportsAsyncSwap(); 98 virtual bool SupportsAsyncSwap();
96 99
97 // Returns the internal frame buffer object name if the surface is backed by 100 // Returns the internal frame buffer object name if the surface is backed by
98 // FBO. Otherwise returns 0. 101 // FBO. Otherwise returns 0.
99 virtual unsigned int GetBackingFramebufferObject(); 102 virtual unsigned int GetBackingFramebufferObject();
100 103
101 typedef base::Callback<void(gfx::SwapResult)> SwapCompletionCallback; 104 typedef base::Callback<void(gfx::SwapResult)> SwapCompletionCallback;
102 // Swaps front and back buffers. This has no effect for off-screen 105 // Swaps front and back buffers. This has no effect for off-screen
103 // contexts. On some platforms, we want to send SwapBufferAck only after the 106 // contexts. On some platforms, we want to send SwapBufferAck only after the
104 // surface is displayed on screen. The callback can be used to delay sending 107 // surface is displayed on screen. The callback can be used to delay sending
105 // SwapBufferAck till that data is available. The callback should be run on 108 // SwapBufferAck till that data is available. The callback should be run on
106 // the calling thread (i.e. same thread SwapBuffersAsync is called) 109 // the calling thread (i.e. same thread SwapBuffersAsync is called)
107 virtual void SwapBuffersAsync(const SwapCompletionCallback& callback); 110 virtual void SwapBuffersAsync(const SwapCompletionCallback& callback);
108 111
112 // Swap buffers with damage rect.
113 virtual gfx::SwapResult SwapBuffersWithDamage(int x,
114 int y,
115 int width,
116 int height);
117
109 // Copy part of the backbuffer to the frontbuffer. 118 // Copy part of the backbuffer to the frontbuffer.
110 virtual gfx::SwapResult PostSubBuffer(int x, int y, int width, int height); 119 virtual gfx::SwapResult PostSubBuffer(int x, int y, int width, int height);
111 120
112 // Copy part of the backbuffer to the frontbuffer. On some platforms, we want 121 // Copy part of the backbuffer to the frontbuffer. On some platforms, we want
113 // to send SwapBufferAck only after the surface is displayed on screen. The 122 // to send SwapBufferAck only after the surface is displayed on screen. The
114 // callback can be used to delay sending SwapBufferAck till that data is 123 // callback can be used to delay sending SwapBufferAck till that data is
115 // available. The callback should be run on the calling thread (i.e. same 124 // available. The callback should be run on the calling thread (i.e. same
116 // thread PostSubBufferAsync is called) 125 // thread PostSubBufferAsync is called)
117 virtual void PostSubBufferAsync(int x, 126 virtual void PostSubBufferAsync(int x,
118 int y, 127 int y,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 bool Initialize(GLSurface::Format format) override; 234 bool Initialize(GLSurface::Format format) override;
226 void Destroy() override; 235 void Destroy() override;
227 bool Resize(const gfx::Size& size, 236 bool Resize(const gfx::Size& size,
228 float scale_factor, 237 float scale_factor,
229 bool has_alpha) override; 238 bool has_alpha) override;
230 bool Recreate() override; 239 bool Recreate() override;
231 bool DeferDraws() override; 240 bool DeferDraws() override;
232 bool IsOffscreen() override; 241 bool IsOffscreen() override;
233 gfx::SwapResult SwapBuffers() override; 242 gfx::SwapResult SwapBuffers() override;
234 void SwapBuffersAsync(const SwapCompletionCallback& callback) override; 243 void SwapBuffersAsync(const SwapCompletionCallback& callback) override;
244 gfx::SwapResult SwapBuffersWithDamage(int x,
245 int y,
246 int width,
247 int height) override;
235 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; 248 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override;
236 void PostSubBufferAsync(int x, 249 void PostSubBufferAsync(int x,
237 int y, 250 int y,
238 int width, 251 int width,
239 int height, 252 int height,
240 const SwapCompletionCallback& callback) override; 253 const SwapCompletionCallback& callback) override;
241 gfx::SwapResult CommitOverlayPlanes() override; 254 gfx::SwapResult CommitOverlayPlanes() override;
242 void CommitOverlayPlanesAsync( 255 void CommitOverlayPlanesAsync(
243 const SwapCompletionCallback& callback) override; 256 const SwapCompletionCallback& callback) override;
257 bool SupportsSwapBuffersWithDamage() override;
244 bool SupportsPostSubBuffer() override; 258 bool SupportsPostSubBuffer() override;
245 bool SupportsCommitOverlayPlanes() override; 259 bool SupportsCommitOverlayPlanes() override;
246 bool SupportsAsyncSwap() override; 260 bool SupportsAsyncSwap() override;
247 gfx::Size GetSize() override; 261 gfx::Size GetSize() override;
248 void* GetHandle() override; 262 void* GetHandle() override;
249 unsigned int GetBackingFramebufferObject() override; 263 unsigned int GetBackingFramebufferObject() override;
250 bool OnMakeCurrent(GLContext* context) override; 264 bool OnMakeCurrent(GLContext* context) override;
251 bool SetBackbufferAllocation(bool allocated) override; 265 bool SetBackbufferAllocation(bool allocated) override;
252 void SetFrontbufferAllocation(bool allocated) override; 266 void SetFrontbufferAllocation(bool allocated) override;
253 void* GetShareHandle() override; 267 void* GetShareHandle() override;
(...skipping 23 matching lines...) Expand all
277 291
278 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a 292 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a
279 // scoped_refptr containing the initialized GLSurface or nullptr if 293 // scoped_refptr containing the initialized GLSurface or nullptr if
280 // initialization fails. 294 // initialization fails.
281 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( 295 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface(
282 scoped_refptr<GLSurface> surface); 296 scoped_refptr<GLSurface> surface);
283 297
284 } // namespace gl 298 } // namespace gl
285 299
286 #endif // UI_GL_GL_SURFACE_H_ 300 #endif // UI_GL_GL_SURFACE_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_bindings_autogen_egl.cc ('k') | ui/gl/gl_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698