OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_COMPOSITOR_BUFFERED_OUTPUT_SURFACE_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_BUFFERED_OUTPUT_SURFACE_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "content/common/content_export.h" |
| 12 #include "ui/gfx/size.h" |
| 13 |
| 14 namespace cc { |
| 15 class ContextProvider; |
| 16 } |
| 17 |
| 18 namespace content { |
| 19 |
| 20 // Provides a surface that manages its own uffers, backed by |
| 21 // CreateImageCHROMIUM. Double/triple buffering is implemented |
| 22 // internally. Doublebuffering occurs if PageFlipComplete is called before |
| 23 // the next BindFramebuffer call, otherwise it creates extra buffers. |
| 24 class CONTENT_EXPORT BufferedOutputSurface { |
| 25 public: |
| 26 BufferedOutputSurface(scoped_refptr<cc::ContextProvider> context_provider, |
| 27 unsigned int internalformat); |
| 28 ~BufferedOutputSurface(); |
| 29 |
| 30 void Initialize(); |
| 31 |
| 32 void BindFramebuffer(); |
| 33 void SwapBuffers(); |
| 34 void PageFlipComplete(); |
| 35 void Reshape(const gfx::Size& size, float scale_factor); |
| 36 |
| 37 unsigned int tex_id() { return tex_id_; } |
| 38 |
| 39 private: |
| 40 friend class BufferedOutputSurfaceTest; |
| 41 |
| 42 void FreeAllSurfaces(); |
| 43 |
| 44 void FreeSurface(unsigned int* surface); |
| 45 |
| 46 // Return a surface, available to be drawn into. |
| 47 unsigned int GetNextSurface(); |
| 48 |
| 49 gfx::Size size_; |
| 50 scoped_refptr<cc::ContextProvider> context_provider_; |
| 51 unsigned int fbo_, depth_rb_, tex_id_; |
| 52 unsigned int internalformat_; |
| 53 unsigned int current_surface_; // This surface is currently bound. |
| 54 unsigned int last_surface_; // This surface has been sent to the hardware. |
| 55 std::vector<unsigned int> available_surfaces_; // These are free for use. |
| 56 unsigned int in_flight_surface_; // This surface is waiting for the callback. |
| 57 }; |
| 58 |
| 59 } // namespace content |
| 60 |
| 61 #endif // CONTENT_BROWSER_COMPOSITOR_BUFFERED_OUTPUT_SURFACE_H_ |
OLD | NEW |