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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 public: | 22 public: |
23 virtual ~Strategy() {} | 23 virtual ~Strategy() {} |
24 // Returns false if the strategy cannot be made to work with the | 24 // Returns false if the strategy cannot be made to work with the |
25 // current set of render passes. Returns true if the strategy was successful | 25 // current set of render passes. Returns true if the strategy was successful |
26 // and adds any additional passes necessary to represent overlays to | 26 // and adds any additional passes necessary to represent overlays to |
27 // |render_passes|. Strategy can also optimize |damage_rect| as it seems | 27 // |render_passes|. Strategy can also optimize |damage_rect| as it seems |
28 // fit to reduce GL composition, in case |damage_rect| is obscured by | 28 // fit to reduce GL composition, in case |damage_rect| is obscured by |
29 // overlays. | 29 // overlays. |
30 virtual bool Attempt(ResourceProvider* resource_provider, | 30 virtual bool Attempt(ResourceProvider* resource_provider, |
31 RenderPassList* render_passes, | 31 RenderPassList* render_passes, |
32 OverlayCandidateList* candidates, | 32 OverlayCandidateList* candidates) = 0; |
33 gfx::Rect* damage_rect) = 0; | |
34 }; | 33 }; |
35 using StrategyList = std::vector<scoped_ptr<Strategy>>; | 34 using StrategyList = std::vector<scoped_ptr<Strategy>>; |
36 | 35 |
37 explicit OverlayProcessor(OutputSurface* surface); | 36 explicit OverlayProcessor(OutputSurface* surface); |
38 virtual ~OverlayProcessor(); | 37 virtual ~OverlayProcessor(); |
39 // Virtual to allow testing different strategies. | 38 // Virtual to allow testing different strategies. |
40 virtual void Initialize(); | 39 virtual void Initialize(); |
41 | 40 |
42 bool ProcessForCALayers(ResourceProvider* resource_provider, | 41 gfx::Rect GetAndResetOverlayDamage(); |
43 RenderPassList* render_passes, | |
44 CALayerOverlayList* ca_layer_overlays, | |
45 OverlayCandidateList* overlay_candidates); | |
46 | 42 |
47 void ProcessForOverlays(ResourceProvider* resource_provider, | 43 void ProcessForOverlays(ResourceProvider* resource_provider, |
48 RenderPassList* render_passes, | 44 RenderPassList* render_passes, |
49 OverlayCandidateList* candidates, | 45 OverlayCandidateList* overlay_candidates, |
| 46 CALayerOverlayList* ca_layer_overlays, |
50 gfx::Rect* damage_rect); | 47 gfx::Rect* damage_rect); |
51 | 48 |
52 protected: | 49 protected: |
53 StrategyList strategies_; | 50 StrategyList strategies_; |
54 OutputSurface* surface_; | 51 OutputSurface* surface_; |
| 52 gfx::Rect overlay_damage_rect_; |
55 | 53 |
56 private: | 54 private: |
| 55 bool ProcessForCALayers(ResourceProvider* resource_provider, |
| 56 RenderPassList* render_passes, |
| 57 OverlayCandidateList* overlay_candidates, |
| 58 CALayerOverlayList* ca_layer_overlays, |
| 59 gfx::Rect* damage_rect); |
| 60 |
57 DISALLOW_COPY_AND_ASSIGN(OverlayProcessor); | 61 DISALLOW_COPY_AND_ASSIGN(OverlayProcessor); |
58 }; | 62 }; |
59 | 63 |
60 } // namespace cc | 64 } // namespace cc |
61 | 65 |
62 #endif // CC_OUTPUT_OVERLAY_PROCESSOR_H_ | 66 #endif // CC_OUTPUT_OVERLAY_PROCESSOR_H_ |
OLD | NEW |