| 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> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 11 #include "cc/output/ca_layer_overlay.h" | 12 #include "cc/output/ca_layer_overlay.h" |
| 12 #include "cc/output/overlay_candidate.h" | 13 #include "cc/output/overlay_candidate.h" |
| 13 #include "cc/quads/render_pass.h" | 14 #include "cc/quads/render_pass.h" |
| 14 | 15 |
| 15 namespace cc { | 16 namespace cc { |
| 16 class OutputSurface; | 17 class OutputSurface; |
| 17 class ResourceProvider; | 18 class ResourceProvider; |
| 18 | 19 |
| 19 class CC_EXPORT OverlayProcessor { | 20 class CC_EXPORT OverlayProcessor { |
| 20 public: | 21 public: |
| 21 class CC_EXPORT Strategy { | 22 class CC_EXPORT Strategy { |
| 22 public: | 23 public: |
| 23 virtual ~Strategy() {} | 24 virtual ~Strategy() {} |
| 24 // 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 |
| 25 // 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 |
| 26 // and adds any additional passes necessary to represent overlays to | 27 // and adds any additional passes necessary to represent overlays to |
| 27 // |render_passes|. | 28 // |render_passes|. |
| 28 virtual bool Attempt(ResourceProvider* resource_provider, | 29 virtual bool Attempt(ResourceProvider* resource_provider, |
| 29 RenderPass* render_pass, | 30 RenderPass* render_pass, |
| 30 OverlayCandidateList* candidates) = 0; | 31 OverlayCandidateList* candidates) = 0; |
| 31 }; | 32 }; |
| 32 using StrategyList = std::vector<scoped_ptr<Strategy>>; | 33 using StrategyList = std::vector<std::unique_ptr<Strategy>>; |
| 33 | 34 |
| 34 explicit OverlayProcessor(OutputSurface* surface); | 35 explicit OverlayProcessor(OutputSurface* surface); |
| 35 virtual ~OverlayProcessor(); | 36 virtual ~OverlayProcessor(); |
| 36 // Virtual to allow testing different strategies. | 37 // Virtual to allow testing different strategies. |
| 37 virtual void Initialize(); | 38 virtual void Initialize(); |
| 38 | 39 |
| 39 gfx::Rect GetAndResetOverlayDamage(); | 40 gfx::Rect GetAndResetOverlayDamage(); |
| 40 | 41 |
| 41 // Attempt to replace quads from the specified root render pass with overlays | 42 // Attempt to replace quads from the specified root render pass with overlays |
| 42 // or CALayers. This must be called every frame. | 43 // or CALayers. This must be called every frame. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 61 // Update |damage_rect| by removing damage casued by |candidates|. | 62 // Update |damage_rect| by removing damage casued by |candidates|. |
| 62 void UpdateDamageRect(OverlayCandidateList* candidates, | 63 void UpdateDamageRect(OverlayCandidateList* candidates, |
| 63 gfx::Rect* damage_rect); | 64 gfx::Rect* damage_rect); |
| 64 | 65 |
| 65 DISALLOW_COPY_AND_ASSIGN(OverlayProcessor); | 66 DISALLOW_COPY_AND_ASSIGN(OverlayProcessor); |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 } // namespace cc | 69 } // namespace cc |
| 69 | 70 |
| 70 #endif // CC_OUTPUT_OVERLAY_PROCESSOR_H_ | 71 #endif // CC_OUTPUT_OVERLAY_PROCESSOR_H_ |
| OLD | NEW |