OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_fullscreen.h" |
| 6 |
| 7 #include "cc/base/math_util.h" |
| 8 #include "cc/output/overlay_candidate_validator.h" |
| 9 #include "cc/quads/draw_quad.h" |
| 10 #include "cc/quads/solid_color_draw_quad.h" |
| 11 #include "ui/gfx/geometry/rect_conversions.h" |
| 12 #include "ui/gfx/geometry/size_conversions.h" |
| 13 |
| 14 namespace cc { |
| 15 |
| 16 OverlayStrategyFullscreen::OverlayStrategyFullscreen() {} |
| 17 |
| 18 OverlayStrategyFullscreen::~OverlayStrategyFullscreen() {} |
| 19 |
| 20 bool OverlayStrategyFullscreen::Attempt(ResourceProvider* resource_provider, |
| 21 RenderPass* render_pass, |
| 22 OverlayCandidateList* candidate_list) { |
| 23 QuadList* quad_list = &render_pass->quad_list; |
| 24 // First quad of quad_list is the top most quad. |
| 25 auto front = quad_list->begin(); |
| 26 while (front != quad_list->end()) { |
| 27 if (!OverlayCandidate::IsInvisibleQuad(*front)) |
| 28 break; |
| 29 front++; |
| 30 } |
| 31 |
| 32 if (front == quad_list->end()) |
| 33 return false; |
| 34 |
| 35 OverlayCandidate candidate; |
| 36 if (!OverlayCandidate::FromDrawQuad(resource_provider, *front, &candidate)) { |
| 37 return false; |
| 38 } |
| 39 |
| 40 if (candidate.transform != gfx::OVERLAY_TRANSFORM_NONE) { |
| 41 return false; |
| 42 } |
| 43 |
| 44 if (!candidate.display_rect.origin().IsOrigin() || |
| 45 gfx::ToRoundedSize(candidate.display_rect.size()) != |
| 46 render_pass->output_rect.size() || |
| 47 render_pass->output_rect.size() != candidate.resource_size_in_pixels) { |
| 48 return false; |
| 49 } |
| 50 |
| 51 candidate.plane_z_order = 1; |
| 52 candidate.overlay_handled = true; |
| 53 candidate_list->push_back(candidate); |
| 54 quad_list->EraseAndInvalidateAllPointers(quad_list->begin()); |
| 55 return true; |
| 56 } |
| 57 |
| 58 } // namespace cc |
OLD | NEW |