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

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

Issue 1408953005: Revert of Avoid Copying damage rect when using Overlays (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_unittest.cc » ('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 "ui/gfx/geometry/rect_conversions.h" 10 #include "ui/gfx/geometry/rect_conversions.h"
11 #include "ui/gfx/transform.h" 11 #include "ui/gfx/transform.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 namespace {
16
17 bool SortByZOrder(const OverlayCandidate& a, const OverlayCandidate& b) {
18 return (a.plane_z_order < b.plane_z_order);
19 }
20
21 } // namespace
22
23 OverlayProcessor::OverlayProcessor(OutputSurface* surface) : surface_(surface) { 15 OverlayProcessor::OverlayProcessor(OutputSurface* surface) : surface_(surface) {
24 } 16 }
25 17
26 void OverlayProcessor::Initialize() { 18 void OverlayProcessor::Initialize() {
27 DCHECK(surface_); 19 DCHECK(surface_);
28 OverlayCandidateValidator* validator = 20 OverlayCandidateValidator* validator =
29 surface_->GetOverlayCandidateValidator(); 21 surface_->GetOverlayCandidateValidator();
30 if (validator) 22 if (validator)
31 validator->GetStrategies(&strategies_); 23 validator->GetStrategies(&strategies_);
32 } 24 }
33 25
34 OverlayProcessor::~OverlayProcessor() {} 26 OverlayProcessor::~OverlayProcessor() {}
35 27
36 void OverlayProcessor::ProcessForOverlays(ResourceProvider* resource_provider, 28 void OverlayProcessor::ProcessForOverlays(ResourceProvider* resource_provider,
37 RenderPassList* render_passes, 29 RenderPassList* render_passes,
38 OverlayCandidateList* candidates, 30 OverlayCandidateList* candidates) {
39 gfx::Rect* damage_rect) {
40 for (auto strategy : strategies_) { 31 for (auto strategy : strategies_) {
41 if (strategy->Attempt(resource_provider, render_passes, candidates)) { 32 if (strategy->Attempt(resource_provider, render_passes, candidates))
42 std::sort(candidates->begin(), candidates->end(), SortByZOrder);
43
44 for (const OverlayCandidate& overlay : *candidates) {
45 if (overlay.plane_z_order <= 0 || overlay.needs_blending)
46 continue;
47
48 damage_rect->Subtract(ToEnclosedRect(overlay.display_rect));
49 }
50
51 return; 33 return;
52 }
53 } 34 }
54 } 35 }
55 36
56 } // namespace cc 37 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/overlay_processor.h ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698