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

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: 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
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..24fe1ee48352e7962575a311feef77c542586b02
--- /dev/null
+++ b/cc/output/overlay_strategy_all_or_nothing.cc
@@ -0,0 +1,47 @@
+// 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_in_draw_order,
+ OverlayCandidateList* candidates,
+ float device_scale_factor) {
+ QuadList& quad_list = render_passes_in_draw_order->back()->quad_list;
+ OverlayCandidateList new_candidates;
+
+ for (const DrawQuad* quad : quad_list) {
+ OverlayCandidate candidate;
+ if (!OverlayCandidate::FromDrawQuad(quad, &candidate))
+ return false;
+ new_candidates.push_back(candidate);
+ }
+
+ int next_z_order = 1;
+ for (auto it = new_candidates.rbegin(); it != new_candidates.rend(); ++it)
+ 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.
+
+ capability_checker_->CheckOverlaySupport(&new_candidates);
+ for (const OverlayCandidate& candidate : new_candidates) {
+ if (candidate.plane_z_order > 0 && !candidate.overlay_handled)
+ return false;
+ }
+
+ quad_list.clear();
+ candidates->swap(new_candidates);
+ return true;
+}
+
+} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698