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 #include "cc/output/overlay_processor.h" | 5 #include "cc/output/overlay_processor.h" |
6 | 6 |
7 #include "cc/output/output_surface.h" | 7 #include "cc/output/output_surface.h" |
8 #include "cc/output/overlay_strategy_sandwich.h" | |
8 #include "cc/output/overlay_strategy_single_on_top.h" | 9 #include "cc/output/overlay_strategy_single_on_top.h" |
9 #include "cc/output/overlay_strategy_underlay.h" | 10 #include "cc/output/overlay_strategy_underlay.h" |
10 #include "ui/gfx/geometry/rect_conversions.h" | 11 #include "ui/gfx/geometry/rect_conversions.h" |
11 #include "ui/gfx/transform.h" | 12 #include "ui/gfx/transform.h" |
12 | 13 |
13 namespace cc { | 14 namespace cc { |
14 | 15 |
16 OverlayProcessor::RendererState::RendererState() : device_scale_factor(1) {} | |
17 OverlayProcessor::RendererState::~RendererState() {} | |
18 | |
15 OverlayProcessor::OverlayProcessor(OutputSurface* surface) : surface_(surface) { | 19 OverlayProcessor::OverlayProcessor(OutputSurface* surface) : surface_(surface) { |
16 } | 20 } |
17 | 21 |
18 void OverlayProcessor::Initialize() { | 22 void OverlayProcessor::Initialize() { |
19 DCHECK(surface_); | 23 DCHECK(surface_); |
20 | 24 |
21 OverlayCandidateValidator* candidates = | 25 OverlayCandidateValidator* candidates = |
22 surface_->GetOverlayCandidateValidator(); | 26 surface_->GetOverlayCandidateValidator(); |
23 if (candidates) { | 27 if (candidates) { |
28 #if defined(OS_MACOSX) | |
ccameron
2015/08/23 21:29:05
Is this (the #ifdef) a reasonable way to go about
alexst (slow to review)
2015/08/24 15:07:02
I hope to keep this platform agnostic. Maybe we co
| |
29 strategies_.push_back( | |
30 scoped_ptr<Strategy>(new OverlayStrategySandwich(candidates))); | |
31 #else | |
24 strategies_.push_back( | 32 strategies_.push_back( |
25 scoped_ptr<Strategy>(new OverlayStrategySingleOnTop(candidates))); | 33 scoped_ptr<Strategy>(new OverlayStrategySingleOnTop(candidates))); |
26 strategies_.push_back( | 34 strategies_.push_back( |
27 scoped_ptr<Strategy>(new OverlayStrategyUnderlay(candidates))); | 35 scoped_ptr<Strategy>(new OverlayStrategyUnderlay(candidates))); |
36 #endif | |
28 } | 37 } |
29 } | 38 } |
30 | 39 |
31 OverlayProcessor::~OverlayProcessor() {} | 40 OverlayProcessor::~OverlayProcessor() {} |
32 | 41 |
33 void OverlayProcessor::ProcessForOverlays( | 42 void OverlayProcessor::ProcessForOverlays( |
43 const OverlayProcessor::RendererState& renderer_state, | |
34 RenderPassList* render_passes_in_draw_order, | 44 RenderPassList* render_passes_in_draw_order, |
35 OverlayCandidateList* candidate_list) { | 45 OverlayCandidateList* candidate_list) { |
36 for (StrategyList::iterator it = strategies_.begin(); it != strategies_.end(); | 46 for (StrategyList::iterator it = strategies_.begin(); it != strategies_.end(); |
37 ++it) { | 47 ++it) { |
38 if ((*it)->Attempt(render_passes_in_draw_order, candidate_list)) | 48 if ((*it)->Attempt(renderer_state, render_passes_in_draw_order, |
49 candidate_list)) { | |
39 return; | 50 return; |
51 } | |
40 } | 52 } |
41 } | 53 } |
42 | 54 |
43 } // namespace cc | 55 } // namespace cc |
OLD | NEW |