| 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_single_on_top.h" | 8 #include "cc/output/overlay_strategy_single_on_top.h" |
| 9 #include "cc/quads/draw_quad.h" | 9 #include "cc/quads/draw_quad.h" |
| 10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
| 11 #include "ui/gfx/rect_conversions.h" | 11 #include "ui/gfx/rect_conversions.h" |
| 12 #include "ui/gfx/transform.h" | 12 #include "ui/gfx/transform.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 OverlayProcessor::OverlayProcessor(OutputSurface* surface, | 16 OverlayProcessor::OverlayProcessor(OutputSurface* surface, |
| 17 ResourceProvider* resource_provider) | 17 ResourceProvider* resource_provider) |
| 18 : surface_(surface), resource_provider_(resource_provider) {} | 18 : surface_(surface), resource_provider_(resource_provider) {} |
| 19 | 19 |
| 20 void OverlayProcessor::Initialize() { | 20 void OverlayProcessor::Initialize() { |
| 21 DCHECK(surface_); | 21 DCHECK(surface_); |
| 22 DCHECK(resource_provider_); | 22 if (!resource_provider_) |
| 23 return; |
| 24 |
| 23 OverlayCandidateValidator* candidates = | 25 OverlayCandidateValidator* candidates = |
| 24 surface_->overlay_candidate_validator(); | 26 surface_->overlay_candidate_validator(); |
| 25 if (candidates) { | 27 if (candidates) { |
| 26 strategies_.push_back(scoped_ptr<Strategy>( | 28 strategies_.push_back(scoped_ptr<Strategy>( |
| 27 new OverlayStrategySingleOnTop(candidates, resource_provider_))); | 29 new OverlayStrategySingleOnTop(candidates, resource_provider_))); |
| 28 } | 30 } |
| 29 } | 31 } |
| 30 | 32 |
| 31 OverlayProcessor::~OverlayProcessor() {} | 33 OverlayProcessor::~OverlayProcessor() {} |
| 32 | 34 |
| 33 void OverlayProcessor::ProcessForOverlays( | 35 void OverlayProcessor::ProcessForOverlays( |
| 34 RenderPassList* render_passes_in_draw_order) { | 36 RenderPassList* render_passes_in_draw_order, |
| 37 OverlayCandidateList* candidate_list) { |
| 35 for (StrategyList::iterator it = strategies_.begin(); it != strategies_.end(); | 38 for (StrategyList::iterator it = strategies_.begin(); it != strategies_.end(); |
| 36 ++it) { | 39 ++it) { |
| 37 if ((*it)->Attempt(render_passes_in_draw_order)) | 40 if ((*it)->Attempt(render_passes_in_draw_order, candidate_list)) |
| 38 return; | 41 return; |
| 39 } | 42 } |
| 40 } | 43 } |
| 41 | 44 |
| 42 } // namespace cc | 45 } // namespace cc |
| OLD | NEW |