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 <limits> | 7 #include <limits> |
8 | 8 |
9 #include "cc/output/overlay_candidate_validator.h" | 9 #include "cc/output/overlay_candidate_validator.h" |
10 #include "cc/quads/draw_quad.h" | 10 #include "cc/quads/draw_quad.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 OverlayCandidate candidate; | 29 OverlayCandidate candidate; |
30 QuadList& quad_list = root_render_pass->quad_list; | 30 QuadList& quad_list = root_render_pass->quad_list; |
31 auto candidate_iterator = quad_list.end(); | 31 auto candidate_iterator = quad_list.end(); |
32 for (auto it = quad_list.begin(); it != quad_list.end(); ++it) { | 32 for (auto it = quad_list.begin(); it != quad_list.end(); ++it) { |
33 const DrawQuad* draw_quad = *it; | 33 const DrawQuad* draw_quad = *it; |
34 if (IsOverlayQuad(draw_quad)) { | 34 if (IsOverlayQuad(draw_quad)) { |
35 // Check that no prior quads overlap it. | 35 // Check that no prior quads overlap it. |
36 bool intersects = false; | 36 bool intersects = false; |
37 gfx::RectF rect = draw_quad->rect; | 37 gfx::RectF rect = draw_quad->rect; |
38 draw_quad->shared_quad_state->content_to_target_transform.TransformRect( | 38 draw_quad->shared_quad_state->quad_to_target_transform.TransformRect( |
39 &rect); | 39 &rect); |
40 for (auto overlap_iter = quad_list.cbegin(); overlap_iter != it; | 40 for (auto overlap_iter = quad_list.cbegin(); overlap_iter != it; |
41 ++overlap_iter) { | 41 ++overlap_iter) { |
42 gfx::RectF overlap_rect = overlap_iter->rect; | 42 gfx::RectF overlap_rect = overlap_iter->rect; |
43 overlap_iter->shared_quad_state->content_to_target_transform | 43 overlap_iter->shared_quad_state->quad_to_target_transform.TransformRect( |
44 .TransformRect(&overlap_rect); | 44 &overlap_rect); |
45 if (rect.Intersects(overlap_rect) && !IsInvisibleQuad(*overlap_iter)) { | 45 if (rect.Intersects(overlap_rect) && !IsInvisibleQuad(*overlap_iter)) { |
46 intersects = true; | 46 intersects = true; |
47 break; | 47 break; |
48 } | 48 } |
49 } | 49 } |
50 if (intersects || !GetCandidateQuadInfo(*draw_quad, &candidate)) | 50 if (intersects || !GetCandidateQuadInfo(*draw_quad, &candidate)) |
51 continue; | 51 continue; |
52 candidate_iterator = it; | 52 candidate_iterator = it; |
53 break; | 53 break; |
54 } | 54 } |
(...skipping 17 matching lines...) Expand all Loading... |
72 // If the candidate can be handled by an overlay, create a pass for it. | 72 // If the candidate can be handled by an overlay, create a pass for it. |
73 if (candidates[1].overlay_handled) { | 73 if (candidates[1].overlay_handled) { |
74 quad_list.EraseAndInvalidateAllPointers(candidate_iterator); | 74 quad_list.EraseAndInvalidateAllPointers(candidate_iterator); |
75 candidate_list->swap(candidates); | 75 candidate_list->swap(candidates); |
76 return true; | 76 return true; |
77 } | 77 } |
78 return false; | 78 return false; |
79 } | 79 } |
80 | 80 |
81 } // namespace cc | 81 } // namespace cc |
OLD | NEW |