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

Side by Side Diff: content/browser/compositor/buffered_output_surface.h

Issue 516663003: Surfaceless OutputSurface implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698