Chromium Code Reviews| Index: content/browser/compositor/buffer_queue.h |
| diff --git a/content/browser/compositor/buffer_queue.h b/content/browser/compositor/buffer_queue.h |
| index 2b6185cadcceb5b2b2d1561c9ad45ef9ca168ed1..91f977dd5f32b3b9340b75447046347b05bb0dd1 100644 |
| --- a/content/browser/compositor/buffer_queue.h |
| +++ b/content/browser/compositor/buffer_queue.h |
| @@ -9,7 +9,9 @@ |
| #include <vector> |
| #include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "content/common/content_export.h" |
| +#include "ui/gfx/rect.h" |
| #include "ui/gfx/size.h" |
| namespace cc { |
| @@ -18,6 +20,8 @@ class ContextProvider; |
| namespace content { |
| +class GLHelper; |
| + |
| // Provides a surface that manages its own uffers, backed by |
| // CreateImageCHROMIUM. Double/triple buffering is implemented |
| // internally. Doublebuffering occurs if PageFlipComplete is called before |
| @@ -25,13 +29,14 @@ namespace content { |
| class CONTENT_EXPORT BufferQueue { |
| public: |
| BufferQueue(scoped_refptr<cc::ContextProvider> context_provider, |
| + GLHelper* gl_helper, |
| unsigned int internalformat); |
| - ~BufferQueue(); |
| + virtual ~BufferQueue(); |
| bool Initialize(); |
| void BindFramebuffer(); |
| - void SwapBuffers(); |
| + void SwapBuffers(const gfx::Rect& damage); |
| void PageFlipComplete(); |
| void Reshape(const gfx::Size& size, float scale_factor); |
| @@ -39,18 +44,29 @@ class CONTENT_EXPORT BufferQueue { |
| private: |
| friend class BufferQueueTest; |
| + |
| struct AllocatedSurface { |
| AllocatedSurface() : texture(0), image(0) {} |
| - AllocatedSurface(unsigned int texture, unsigned int image) |
| - : texture(texture), image(image) {} |
| + AllocatedSurface(unsigned int texture, |
| + unsigned int image, |
| + const gfx::Rect& rect) |
| + : texture(texture), image(image), damage(rect) {} |
| unsigned int texture; |
| unsigned int image; |
| + gfx::Rect damage; // This is the damage for this frame from the previous. |
| }; |
| void FreeAllSurfaces(); |
| void FreeSurface(AllocatedSurface* surface); |
| + // Copy everything that is in |copy_rect|, except for what is in |
| + // |exclude_rect| from |source_texture| to |texture| |
|
alexst (slow to review)
2014/09/17 20:34:06
nit: period at the end.
|
| + virtual void CopyBufferDamage(int texture, |
| + int source_texture, |
| + const gfx::Rect& exclude_rect, |
|
alexst (slow to review)
2014/09/17 20:34:05
can you keep the names consistent with GLHelper as
achaulk
2014/09/17 20:41:57
Done.
|
| + const gfx::Rect& copy_rect); |
| + |
| // Return a surface, available to be drawn into. |
| AllocatedSurface GetNextSurface(); |
| @@ -61,7 +77,8 @@ class CONTENT_EXPORT BufferQueue { |
| unsigned int internalformat_; |
| AllocatedSurface current_surface_; // This surface is currently bound. |
| std::vector<AllocatedSurface> available_surfaces_; // These are free for use. |
| - std::queue<AllocatedSurface> in_flight_surfaces_; |
| + std::deque<AllocatedSurface> in_flight_surfaces_; |
| + GLHelper* gl_helper_; |
| DISALLOW_COPY_AND_ASSIGN(BufferQueue); |
| }; |