OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/output/overlay_strategy_single_on_top.h" | 5 #include "cc/output/overlay_strategy_single_on_top.h" |
6 | 6 |
7 #include "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
8 #include "cc/output/overlay_candidate_validator.h" | 8 #include "cc/output/overlay_candidate_validator.h" |
9 #include "cc/quads/draw_quad.h" | 9 #include "cc/quads/draw_quad.h" |
10 #include "ui/gfx/buffer_types.h" | 10 #include "ui/gfx/buffer_types.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 RenderPass* render_pass, | 30 RenderPass* render_pass, |
31 OverlayCandidateList* candidate_list, | 31 OverlayCandidateList* candidate_list, |
32 std::vector<gfx::Rect>* content_bounds) { | 32 std::vector<gfx::Rect>* content_bounds) { |
33 QuadList* quad_list = &render_pass->quad_list; | 33 QuadList* quad_list = &render_pass->quad_list; |
34 // Build a list of candidates with the associated quad. | 34 // Build a list of candidates with the associated quad. |
35 OverlayCandidate best_candidate; | 35 OverlayCandidate best_candidate; |
36 QuadList::Iterator best_quad_it = quad_list->end(); | 36 QuadList::Iterator best_quad_it = quad_list->end(); |
37 for (auto it = quad_list->begin(); it != quad_list->end(); ++it) { | 37 for (auto it = quad_list->begin(); it != quad_list->end(); ++it) { |
38 OverlayCandidate candidate; | 38 OverlayCandidate candidate; |
39 if (OverlayCandidate::FromDrawQuad(resource_provider, *it, &candidate) && | 39 if (OverlayCandidate::FromDrawQuad(resource_provider, *it, &candidate) && |
40 // TODO(dcastagna): Remove this once drm platform supports transforms. | |
41 candidate.transform == gfx::OVERLAY_TRANSFORM_NONE && | |
42 !OverlayCandidate::IsOccluded(candidate, quad_list->cbegin(), it)) { | 40 !OverlayCandidate::IsOccluded(candidate, quad_list->cbegin(), it)) { |
43 // We currently reject quads with alpha that do not request alpha blending | 41 // We currently reject quads with alpha that do not request alpha blending |
44 // since the alpha channel might not be set to 1 and we're not disabling | 42 // since the alpha channel might not be set to 1 and we're not disabling |
45 // blending when scanning out. | 43 // blending when scanning out. |
46 // TODO(dcastagna): We should support alpha formats without blending using | 44 // TODO(dcastagna): We should support alpha formats without blending using |
47 // the opaque FB at scanout. | 45 // the opaque FB at scanout. |
48 if (std::find(std::begin(kOverlayFormatsWithAlpha), | 46 if (std::find(std::begin(kOverlayFormatsWithAlpha), |
49 std::end(kOverlayFormatsWithAlpha), | 47 std::end(kOverlayFormatsWithAlpha), |
50 candidate.format) != std::end(kOverlayFormatsWithAlpha) && | 48 candidate.format) != std::end(kOverlayFormatsWithAlpha) && |
51 it->shared_quad_state->blend_mode == SkBlendMode::kSrc) | 49 it->shared_quad_state->blend_mode == SkBlendMode::kSrc) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 if (overlay_candidate.overlay_handled) { | 83 if (overlay_candidate.overlay_handled) { |
86 quad_list->EraseAndInvalidateAllPointers(candidate_iterator); | 84 quad_list->EraseAndInvalidateAllPointers(candidate_iterator); |
87 candidate_list->swap(new_candidate_list); | 85 candidate_list->swap(new_candidate_list); |
88 return true; | 86 return true; |
89 } | 87 } |
90 | 88 |
91 return false; | 89 return false; |
92 } | 90 } |
93 | 91 |
94 } // namespace cc | 92 } // namespace cc |
OLD | NEW |