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