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

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: 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
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(
19 RenderPassList* render_passes_in_draw_order,
20 OverlayCandidateList* candidates,
21 float device_scale_factor) {
22 QuadList& quad_list = render_passes_in_draw_order->back()->quad_list;
23 OverlayCandidateList new_candidates;
24
25 for (const DrawQuad* quad : quad_list) {
26 OverlayCandidate candidate;
27 if (!OverlayCandidate::FromDrawQuad(quad, &candidate))
28 return false;
29 new_candidates.push_back(candidate);
30 }
31
32 int next_z_order = 1;
33 for (auto it = new_candidates.rbegin(); it != new_candidates.rend(); ++it)
34 it->plane_z_order = next_z_order++;
ccameron 2015/09/29 23:29:56 This can be rolled into the above loop by just hav
Andre 2015/09/30 00:18:38 Done.
35
36 capability_checker_->CheckOverlaySupport(&new_candidates);
37 for (const OverlayCandidate& candidate : new_candidates) {
38 if (candidate.plane_z_order > 0 && !candidate.overlay_handled)
39 return false;
40 }
41
42 quad_list.clear();
43 candidates->swap(new_candidates);
44 return true;
45 }
46
47 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698