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

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

Issue 1373373003: Mac Overlays: Add AllOrNothing strategy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@OverlayTest
Patch Set: Rebase off master Created 5 years, 2 months 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_strategy_all_or_nothing.h ('k') | cc/output/overlay_strategy_common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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_strategy_all_or_nothing.h"
6
7 #include "cc/output/overlay_candidate_validator.h"
8 #include "cc/quads/draw_quad.h"
9
10 namespace cc {
11
12 OverlayStrategyAllOrNothing::OverlayStrategyAllOrNothing(
13 OverlayCandidateValidator* capability_checker)
14 : capability_checker_(capability_checker) {}
15
16 OverlayStrategyAllOrNothing::~OverlayStrategyAllOrNothing() {}
17
18 bool OverlayStrategyAllOrNothing::Attempt(RenderPassList* render_passes,
19 OverlayCandidateList* candidates,
20 float device_scale_factor) {
21 QuadList& quad_list = render_passes->back()->quad_list;
22 OverlayCandidateList new_candidates;
23 int next_z_order = -1;
24
25 for (const DrawQuad* quad : quad_list) {
26 OverlayCandidate candidate;
27 if (!OverlayCandidate::FromDrawQuad(quad, &candidate))
28 return false;
29 candidate.plane_z_order = next_z_order--;
30 new_candidates.push_back(candidate);
31 }
32
33 capability_checker_->CheckOverlaySupport(&new_candidates);
34 for (const OverlayCandidate& candidate : new_candidates) {
35 if (!candidate.overlay_handled)
36 return false;
37 }
38
39 quad_list.clear();
40 candidates->swap(new_candidates);
41 return true;
42 }
43
44 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/overlay_strategy_all_or_nothing.h ('k') | cc/output/overlay_strategy_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698