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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class CC_EXPORT Strategy { | 22 class CC_EXPORT Strategy { |
23 public: | 23 public: |
24 virtual ~Strategy() {} | 24 virtual ~Strategy() {} |
25 // Returns false if the strategy cannot be made to work with the | 25 // Returns false if the strategy cannot be made to work with the |
26 // current set of render passes. Returns true if the strategy was successful | 26 // current set of render passes. Returns true if the strategy was successful |
27 // and adds any additional passes necessary to represent overlays to | 27 // and adds any additional passes necessary to represent overlays to |
28 // |render_passes|. | 28 // |render_passes|. |
29 virtual bool Attempt(ResourceProvider* resource_provider, | 29 virtual bool Attempt(ResourceProvider* resource_provider, |
30 RenderPass* render_pass, | 30 RenderPass* render_pass, |
31 OverlayCandidateList* candidates) = 0; | 31 OverlayCandidateList* candidates) = 0; |
| 32 |
| 33 virtual void GetContentBounds(std::vector<gfx::Rect>* bounds); |
32 }; | 34 }; |
33 using StrategyList = std::vector<std::unique_ptr<Strategy>>; | 35 using StrategyList = std::vector<std::unique_ptr<Strategy>>; |
34 | 36 |
35 explicit OverlayProcessor(OutputSurface* surface); | 37 explicit OverlayProcessor(OutputSurface* surface); |
36 virtual ~OverlayProcessor(); | 38 virtual ~OverlayProcessor(); |
37 // Virtual to allow testing different strategies. | 39 // Virtual to allow testing different strategies. |
38 virtual void Initialize(); | 40 virtual void Initialize(); |
39 | 41 |
40 gfx::Rect GetAndResetOverlayDamage(); | 42 gfx::Rect GetAndResetOverlayDamage(); |
| 43 void GetContentBounds(std::vector<gfx::Rect>* content_bounds); |
41 | 44 |
42 // Attempt to replace quads from the specified root render pass with overlays | 45 // Attempt to replace quads from the specified root render pass with overlays |
43 // or CALayers. This must be called every frame. | 46 // or CALayers. This must be called every frame. |
44 void ProcessForOverlays( | 47 void ProcessForOverlays( |
45 ResourceProvider* resource_provider, | 48 ResourceProvider* resource_provider, |
46 RenderPass* root_render_pass, | 49 RenderPass* root_render_pass, |
47 const RenderPassFilterList& render_pass_filters, | 50 const RenderPassFilterList& render_pass_filters, |
48 const RenderPassFilterList& render_pass_background_filters, | 51 const RenderPassFilterList& render_pass_background_filters, |
49 OverlayCandidateList* overlay_candidates, | 52 OverlayCandidateList* overlay_candidates, |
50 CALayerOverlayList* ca_layer_overlays, | 53 CALayerOverlayList* ca_layer_overlays, |
51 gfx::Rect* damage_rect); | 54 gfx::Rect* damage_rect); |
52 | 55 |
53 protected: | 56 protected: |
54 StrategyList strategies_; | 57 StrategyList strategies_; |
55 OutputSurface* surface_; | 58 OutputSurface* surface_; |
56 gfx::Rect overlay_damage_rect_; | 59 gfx::Rect overlay_damage_rect_; |
57 gfx::Rect previous_frame_underlay_rect_; | 60 gfx::Rect previous_frame_underlay_rect_; |
| 61 std::vector<gfx::Rect> content_bounds_; |
58 | 62 |
59 private: | 63 private: |
60 bool ProcessForCALayers( | 64 bool ProcessForCALayers( |
61 ResourceProvider* resource_provider, | 65 ResourceProvider* resource_provider, |
62 RenderPass* render_pass, | 66 RenderPass* render_pass, |
63 const RenderPassFilterList& render_pass_filters, | 67 const RenderPassFilterList& render_pass_filters, |
64 const RenderPassFilterList& render_pass_background_filters, | 68 const RenderPassFilterList& render_pass_background_filters, |
65 OverlayCandidateList* overlay_candidates, | 69 OverlayCandidateList* overlay_candidates, |
66 CALayerOverlayList* ca_layer_overlays, | 70 CALayerOverlayList* ca_layer_overlays, |
67 gfx::Rect* damage_rect); | 71 gfx::Rect* damage_rect); |
68 // Update |damage_rect| by removing damage casued by |candidates|. | 72 // Update |damage_rect| by removing damage casued by |candidates|. |
69 void UpdateDamageRect(OverlayCandidateList* candidates, | 73 void UpdateDamageRect(OverlayCandidateList* candidates, |
70 gfx::Rect* damage_rect); | 74 gfx::Rect* damage_rect); |
71 | 75 |
72 DISALLOW_COPY_AND_ASSIGN(OverlayProcessor); | 76 DISALLOW_COPY_AND_ASSIGN(OverlayProcessor); |
73 }; | 77 }; |
74 | 78 |
75 } // namespace cc | 79 } // namespace cc |
76 | 80 |
77 #endif // CC_OUTPUT_OVERLAY_PROCESSOR_H_ | 81 #endif // CC_OUTPUT_OVERLAY_PROCESSOR_H_ |
OLD | NEW |