OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 CC_OUTPUT_OVERLAY_PROCESSOR_H_ | 5 #ifndef CC_OUTPUT_OVERLAY_PROCESSOR_H_ |
6 #define CC_OUTPUT_OVERLAY_PROCESSOR_H_ | 6 #define CC_OUTPUT_OVERLAY_PROCESSOR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
11 #include "cc/output/overlay_candidate.h" | 11 #include "cc/output/overlay_candidate.h" |
12 #include "cc/quads/render_pass.h" | 12 #include "cc/quads/render_pass.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 class OutputSurface; | 15 class OutputSurface; |
16 class ResourceProvider; | 16 class ResourceProvider; |
17 | 17 |
18 class CC_EXPORT OverlayProcessor { | 18 class CC_EXPORT OverlayProcessor { |
19 public: | 19 public: |
| 20 // State from the renderer that is relevant to the overlay processor |
| 21 // strategies. |
| 22 struct CC_EXPORT RendererState { |
| 23 RendererState(); |
| 24 ~RendererState(); |
| 25 float device_scale_factor; |
| 26 }; |
20 class CC_EXPORT Strategy { | 27 class CC_EXPORT Strategy { |
21 public: | 28 public: |
22 virtual ~Strategy() {} | 29 virtual ~Strategy() {} |
23 // Returns false if the strategy cannot be made to work with the | 30 // Returns false if the strategy cannot be made to work with the |
24 // current set of render passes. Returns true if the strategy was successful | 31 // current set of render passes. Returns true if the strategy was successful |
25 // and adds any additional passes necessary to represent overlays to | 32 // and adds any additional passes necessary to represent overlays to |
26 // |render_passes_in_draw_order|. | 33 // |render_passes_in_draw_order|. |
27 virtual bool Attempt(RenderPassList* render_passes_in_draw_order, | 34 virtual bool Attempt(const RendererState& renderer_state, |
| 35 RenderPassList* render_passes_in_draw_order, |
28 OverlayCandidateList* candidates) = 0; | 36 OverlayCandidateList* candidates) = 0; |
29 }; | 37 }; |
30 typedef ScopedPtrVector<Strategy> StrategyList; | 38 typedef ScopedPtrVector<Strategy> StrategyList; |
31 | 39 |
32 explicit OverlayProcessor(OutputSurface* surface); | 40 explicit OverlayProcessor(OutputSurface* surface); |
33 virtual ~OverlayProcessor(); | 41 virtual ~OverlayProcessor(); |
34 // Virtual to allow testing different strategies. | 42 // Virtual to allow testing different strategies. |
35 virtual void Initialize(); | 43 virtual void Initialize(); |
36 | 44 |
37 void ProcessForOverlays(RenderPassList* render_passes_in_draw_order, | 45 void ProcessForOverlays(const RendererState& renderer_state, |
| 46 RenderPassList* render_passes_in_draw_order, |
38 OverlayCandidateList* candidate_list); | 47 OverlayCandidateList* candidate_list); |
39 | 48 |
40 protected: | 49 protected: |
41 StrategyList strategies_; | 50 StrategyList strategies_; |
42 OutputSurface* surface_; | 51 OutputSurface* surface_; |
43 | 52 |
44 private: | 53 private: |
45 DISALLOW_COPY_AND_ASSIGN(OverlayProcessor); | 54 DISALLOW_COPY_AND_ASSIGN(OverlayProcessor); |
46 }; | 55 }; |
47 | 56 |
48 } // namespace cc | 57 } // namespace cc |
49 | 58 |
50 #endif // CC_OUTPUT_OVERLAY_PROCESSOR_H_ | 59 #endif // CC_OUTPUT_OVERLAY_PROCESSOR_H_ |
OLD | NEW |