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

Unified 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, 3 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/overlay_strategy_all_or_nothing.cc
diff --git a/cc/output/overlay_strategy_all_or_nothing.cc b/cc/output/overlay_strategy_all_or_nothing.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bead0a707b6a3f5983a47c9aab4654b693f59c35
--- /dev/null
+++ b/cc/output/overlay_strategy_all_or_nothing.cc
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/output/overlay_strategy_all_or_nothing.h"
+
+#include "cc/output/overlay_candidate_validator.h"
+#include "cc/quads/draw_quad.h"
+
+namespace cc {
+
+OverlayStrategyAllOrNothing::OverlayStrategyAllOrNothing(
+ OverlayCandidateValidator* capability_checker)
+ : capability_checker_(capability_checker) {}
+
+OverlayStrategyAllOrNothing::~OverlayStrategyAllOrNothing() {}
+
+bool OverlayStrategyAllOrNothing::Attempt(RenderPassList* render_passes,
+ OverlayCandidateList* candidates,
+ float device_scale_factor) {
+ QuadList& quad_list = render_passes->back()->quad_list;
+ OverlayCandidateList new_candidates;
+ int next_z_order = -1;
+
+ for (const DrawQuad* quad : quad_list) {
+ OverlayCandidate candidate;
+ if (!OverlayCandidate::FromDrawQuad(quad, &candidate))
+ return false;
+ candidate.plane_z_order = next_z_order--;
+ new_candidates.push_back(candidate);
+ }
+
+ capability_checker_->CheckOverlaySupport(&new_candidates);
+ for (const OverlayCandidate& candidate : new_candidates) {
+ if (!candidate.overlay_handled)
+ return false;
+ }
+
+ quad_list.clear();
+ candidates->swap(new_candidates);
+ return true;
+}
+
+} // namespace cc
« 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