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