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_underlay.h" | 5 #include "cc/output/overlay_strategy_underlay.h" |
6 | 6 |
7 #include "cc/output/overlay_candidate_validator.h" | 7 #include "cc/output/overlay_candidate_validator.h" |
8 #include "cc/quads/draw_quad.h" | 8 #include "cc/quads/draw_quad.h" |
9 #include "cc/quads/solid_color_draw_quad.h" | 9 #include "cc/quads/solid_color_draw_quad.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 RenderPassList* render_passes_in_draw_order, | 21 RenderPassList* render_passes_in_draw_order, |
22 OverlayCandidateList* candidate_list, | 22 OverlayCandidateList* candidate_list, |
23 const OverlayCandidate& candidate, | 23 const OverlayCandidate& candidate, |
24 QuadList::Iterator candidate_iterator) { | 24 QuadList::Iterator candidate_iterator) { |
25 RenderPass* root_render_pass = render_passes_in_draw_order->back(); | 25 RenderPass* root_render_pass = render_passes_in_draw_order->back(); |
26 QuadList& quad_list = root_render_pass->quad_list; | 26 QuadList& quad_list = root_render_pass->quad_list; |
27 | 27 |
28 // Add our primary surface. | 28 // Add our primary surface. |
29 OverlayCandidateList candidates; | 29 OverlayCandidateList candidates; |
30 OverlayCandidate main_image; | 30 OverlayCandidate main_image; |
31 main_image.display_rect = root_render_pass->output_rect; | 31 main_image.display_rect = gfx::RectF(root_render_pass->output_rect); |
32 candidates.push_back(main_image); | 32 candidates.push_back(main_image); |
33 | 33 |
34 // Add the overlay. | 34 // Add the overlay. |
35 candidates.push_back(candidate); | 35 candidates.push_back(candidate); |
36 candidates.back().plane_z_order = -1; | 36 candidates.back().plane_z_order = -1; |
37 | 37 |
38 // Check for support. | 38 // Check for support. |
39 capability_checker->CheckOverlaySupport(&candidates); | 39 capability_checker->CheckOverlaySupport(&candidates); |
40 | 40 |
41 // If the candidate can be handled by an overlay, create a pass for it. We | 41 // If the candidate can be handled by an overlay, create a pass for it. We |
42 // need to switch out the video quad with a black transparent one. | 42 // need to switch out the video quad with a black transparent one. |
43 if (candidates[1].overlay_handled) { | 43 if (candidates[1].overlay_handled) { |
44 const SharedQuadState* shared_quad_state = | 44 const SharedQuadState* shared_quad_state = |
45 candidate_iterator->shared_quad_state; | 45 candidate_iterator->shared_quad_state; |
46 gfx::Rect rect = candidate_iterator->visible_rect; | 46 gfx::Rect rect = candidate_iterator->visible_rect; |
47 SolidColorDrawQuad* replacement = | 47 SolidColorDrawQuad* replacement = |
48 quad_list.ReplaceExistingElement<SolidColorDrawQuad>( | 48 quad_list.ReplaceExistingElement<SolidColorDrawQuad>( |
49 candidate_iterator); | 49 candidate_iterator); |
50 replacement->SetAll(shared_quad_state, rect, rect, rect, false, | 50 replacement->SetAll(shared_quad_state, rect, rect, rect, false, |
51 SK_ColorTRANSPARENT, true); | 51 SK_ColorTRANSPARENT, true); |
52 candidate_list->swap(candidates); | 52 candidate_list->swap(candidates); |
53 return true; | 53 return true; |
54 } | 54 } |
55 return false; | 55 return false; |
56 } | 56 } |
57 | 57 |
58 } // namespace cc | 58 } // namespace cc |
OLD | NEW |