Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / cc / output / overlay_processor.cc
blobab334ec95344aef8d5d98a4cf14a50a001430a54
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
3 // found in the LICENSE file.
5 #include "cc/output/overlay_processor.h"
7 #include "cc/output/output_surface.h"
8 #include "cc/output/overlay_strategy_single_on_top.h"
9 #include "cc/output/overlay_strategy_underlay.h"
10 #include "ui/gfx/geometry/rect_conversions.h"
11 #include "ui/gfx/transform.h"
13 namespace cc {
15 OverlayProcessor::OverlayProcessor(OutputSurface* surface) : surface_(surface) {
18 void OverlayProcessor::Initialize() {
19 DCHECK(surface_);
20 OverlayCandidateValidator* validator =
21 surface_->GetOverlayCandidateValidator();
22 if (validator)
23 validator->GetStrategies(&strategies_);
26 OverlayProcessor::~OverlayProcessor() {}
28 void OverlayProcessor::ProcessForOverlays(
29 RenderPassList* render_passes_in_draw_order,
30 OverlayCandidateList* candidate_list) {
31 for (StrategyList::iterator it = strategies_.begin(); it != strategies_.end();
32 ++it) {
33 if ((*it)->Attempt(render_passes_in_draw_order, candidate_list,
34 surface_->device_scale_factor())) {
35 return;
40 } // namespace cc