| 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 10 matching lines...) Expand all Loading... |
| 21 public: | 21 public: |
| 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, |
| 32 std::vector<gfx::Rect>* content_bounds) = 0; |
| 32 }; | 33 }; |
| 33 using StrategyList = std::vector<std::unique_ptr<Strategy>>; | 34 using StrategyList = std::vector<std::unique_ptr<Strategy>>; |
| 34 | 35 |
| 35 explicit OverlayProcessor(OutputSurface* surface); | 36 explicit OverlayProcessor(OutputSurface* surface); |
| 36 virtual ~OverlayProcessor(); | 37 virtual ~OverlayProcessor(); |
| 37 // Virtual to allow testing different strategies. | 38 // Virtual to allow testing different strategies. |
| 38 virtual void Initialize(); | 39 virtual void Initialize(); |
| 39 | 40 |
| 40 gfx::Rect GetAndResetOverlayDamage(); | 41 gfx::Rect GetAndResetOverlayDamage(); |
| 41 | 42 |
| 42 // Attempt to replace quads from the specified root render pass with overlays | 43 // Attempt to replace quads from the specified root render pass with overlays |
| 43 // or CALayers. This must be called every frame. | 44 // or CALayers. This must be called every frame. |
| 44 void ProcessForOverlays( | 45 void ProcessForOverlays( |
| 45 ResourceProvider* resource_provider, | 46 ResourceProvider* resource_provider, |
| 46 RenderPass* root_render_pass, | 47 RenderPass* root_render_pass, |
| 47 const RenderPassFilterList& render_pass_filters, | 48 const RenderPassFilterList& render_pass_filters, |
| 48 const RenderPassFilterList& render_pass_background_filters, | 49 const RenderPassFilterList& render_pass_background_filters, |
| 49 OverlayCandidateList* overlay_candidates, | 50 OverlayCandidateList* overlay_candidates, |
| 50 CALayerOverlayList* ca_layer_overlays, | 51 CALayerOverlayList* ca_layer_overlays, |
| 51 gfx::Rect* damage_rect); | 52 gfx::Rect* damage_rect, |
| 53 std::vector<gfx::Rect>* content_bounds); |
| 52 | 54 |
| 53 protected: | 55 protected: |
| 54 StrategyList strategies_; | 56 StrategyList strategies_; |
| 55 OutputSurface* surface_; | 57 OutputSurface* surface_; |
| 56 gfx::Rect overlay_damage_rect_; | 58 gfx::Rect overlay_damage_rect_; |
| 57 gfx::Rect previous_frame_underlay_rect_; | 59 gfx::Rect previous_frame_underlay_rect_; |
| 58 | 60 |
| 59 private: | 61 private: |
| 60 bool ProcessForCALayers( | 62 bool ProcessForCALayers( |
| 61 ResourceProvider* resource_provider, | 63 ResourceProvider* resource_provider, |
| 62 RenderPass* render_pass, | 64 RenderPass* render_pass, |
| 63 const RenderPassFilterList& render_pass_filters, | 65 const RenderPassFilterList& render_pass_filters, |
| 64 const RenderPassFilterList& render_pass_background_filters, | 66 const RenderPassFilterList& render_pass_background_filters, |
| 65 OverlayCandidateList* overlay_candidates, | 67 OverlayCandidateList* overlay_candidates, |
| 66 CALayerOverlayList* ca_layer_overlays, | 68 CALayerOverlayList* ca_layer_overlays, |
| 67 gfx::Rect* damage_rect); | 69 gfx::Rect* damage_rect); |
| 68 // Update |damage_rect| by removing damage casued by |candidates|. | 70 // Update |damage_rect| by removing damage casued by |candidates|. |
| 69 void UpdateDamageRect(OverlayCandidateList* candidates, | 71 void UpdateDamageRect(OverlayCandidateList* candidates, |
| 70 gfx::Rect* damage_rect); | 72 gfx::Rect* damage_rect); |
| 71 | 73 |
| 72 DISALLOW_COPY_AND_ASSIGN(OverlayProcessor); | 74 DISALLOW_COPY_AND_ASSIGN(OverlayProcessor); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 } // namespace cc | 77 } // namespace cc |
| 76 | 78 |
| 77 #endif // CC_OUTPUT_OVERLAY_PROCESSOR_H_ | 79 #endif // CC_OUTPUT_OVERLAY_PROCESSOR_H_ |
| OLD | NEW |