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

Unified Diff: cc/output/overlay_strategy_fullscreen.cc

Issue 2168693002: cc: Add OverlayStrategyFullscreen strategy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set deps. Don't enable strategy by default. Created 4 years, 5 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_fullscreen.h ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/overlay_strategy_fullscreen.cc
diff --git a/cc/output/overlay_strategy_fullscreen.cc b/cc/output/overlay_strategy_fullscreen.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b848bb6cd8f348866e9281fed8eb3021d00eada1
--- /dev/null
+++ b/cc/output/overlay_strategy_fullscreen.cc
@@ -0,0 +1,58 @@
+// Copyright 2016 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_fullscreen.h"
+
+#include "cc/base/math_util.h"
+#include "cc/output/overlay_candidate_validator.h"
+#include "cc/quads/draw_quad.h"
+#include "cc/quads/solid_color_draw_quad.h"
+#include "ui/gfx/geometry/rect_conversions.h"
+#include "ui/gfx/geometry/size_conversions.h"
+
+namespace cc {
+
+OverlayStrategyFullscreen::OverlayStrategyFullscreen() {}
+
+OverlayStrategyFullscreen::~OverlayStrategyFullscreen() {}
+
+bool OverlayStrategyFullscreen::Attempt(ResourceProvider* resource_provider,
+ RenderPass* render_pass,
+ OverlayCandidateList* candidate_list) {
+ QuadList* quad_list = &render_pass->quad_list;
+ // First quad of quad_list is the top most quad.
+ auto front = quad_list->begin();
+ while (front != quad_list->end()) {
+ if (!OverlayCandidate::IsInvisibleQuad(*front))
+ break;
+ front++;
+ }
+
+ if (front == quad_list->end())
+ return false;
+
+ OverlayCandidate candidate;
+ if (!OverlayCandidate::FromDrawQuad(resource_provider, *front, &candidate)) {
+ return false;
+ }
+
+ if (candidate.transform != gfx::OVERLAY_TRANSFORM_NONE) {
+ return false;
+ }
+
+ if (!candidate.display_rect.origin().IsOrigin() ||
+ gfx::ToRoundedSize(candidate.display_rect.size()) !=
+ render_pass->output_rect.size() ||
+ render_pass->output_rect.size() != candidate.resource_size_in_pixels) {
+ return false;
+ }
+
+ candidate.plane_z_order = 1;
+ candidate.overlay_handled = true;
+ candidate_list->push_back(candidate);
+ quad_list->EraseAndInvalidateAllPointers(quad_list->begin());
+ return true;
+}
+
+} // namespace cc
« no previous file with comments | « cc/output/overlay_strategy_fullscreen.h ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698