Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Side by Side Diff: cc/output/overlay_processor.cc

Issue 1430813002: cc: Fork OverlayCandidate to CALayerOverlay (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master1
Patch Set: Rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/overlay_processor.h ('k') | cc/output/overlay_strategy_all_or_nothing.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/output/overlay_strategy_underlay.h" 9 #include "cc/output/overlay_strategy_underlay.h"
10 #include "cc/quads/draw_quad.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
15 OverlayProcessor::OverlayProcessor(OutputSurface* surface) : surface_(surface) { 16 OverlayProcessor::OverlayProcessor(OutputSurface* surface) : surface_(surface) {
16 } 17 }
17 18
18 void OverlayProcessor::Initialize() { 19 void OverlayProcessor::Initialize() {
19 DCHECK(surface_); 20 DCHECK(surface_);
20 OverlayCandidateValidator* validator = 21 OverlayCandidateValidator* validator =
21 surface_->GetOverlayCandidateValidator(); 22 surface_->GetOverlayCandidateValidator();
22 if (validator) 23 if (validator)
23 validator->GetStrategies(&strategies_); 24 validator->GetStrategies(&strategies_);
24 } 25 }
25 26
26 OverlayProcessor::~OverlayProcessor() {} 27 OverlayProcessor::~OverlayProcessor() {}
27 28
29 bool OverlayProcessor::ProcessForCALayers(
30 ResourceProvider* resource_provider,
31 RenderPassList* render_passes,
32 CALayerOverlayList* ca_layer_overlays,
33 OverlayCandidateList* overlay_candidates) {
34 RenderPass* root_render_pass = render_passes->back();
35
36 OverlayCandidateValidator* overlay_validator =
37 surface_->GetOverlayCandidateValidator();
38 if (!overlay_validator || !overlay_validator->AllowCALayerOverlays())
39 return false;
40
41 if (!ProcessForCALayerOverlays(
42 resource_provider, gfx::RectF(root_render_pass->output_rect),
43 root_render_pass->quad_list, ca_layer_overlays))
44 return false;
45
46 // CALayer overlays are all-or-nothing. If all quads were replaced with
47 // layers then clear the list and remove the backbuffer from the overcandidate
48 // list.
49 overlay_candidates->clear();
50 render_passes->back()->quad_list.clear();
51 return true;
52 }
53
28 void OverlayProcessor::ProcessForOverlays(ResourceProvider* resource_provider, 54 void OverlayProcessor::ProcessForOverlays(ResourceProvider* resource_provider,
29 RenderPassList* render_passes, 55 RenderPassList* render_passes,
30 OverlayCandidateList* candidates, 56 OverlayCandidateList* candidates,
31 gfx::Rect* damage_rect) { 57 gfx::Rect* damage_rect) {
32 for (auto strategy : strategies_) { 58 for (auto strategy : strategies_) {
33 if (strategy->Attempt(resource_provider, render_passes, candidates, 59 if (strategy->Attempt(resource_provider, render_passes, candidates,
34 damage_rect)) { 60 damage_rect)) {
35 return; 61 return;
36 } 62 }
37 } 63 }
38 } 64 }
39 65
40 } // namespace cc 66 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/overlay_processor.h ('k') | cc/output/overlay_strategy_all_or_nothing.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698