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 29 matching lines...) Expand all Loading... |
40 if (new_candidate_list.back().overlay_handled) { | 40 if (new_candidate_list.back().overlay_handled) { |
41 new_candidate_list.back().is_unoccluded = | 41 new_candidate_list.back().is_unoccluded = |
42 !OverlayCandidate::IsOccluded(candidate, quad_list.cbegin(), it); | 42 !OverlayCandidate::IsOccluded(candidate, quad_list.cbegin(), it); |
43 const SharedQuadState* shared_quad_state = it->shared_quad_state; | 43 const SharedQuadState* shared_quad_state = it->shared_quad_state; |
44 gfx::Rect rect = it->visible_rect; | 44 gfx::Rect rect = it->visible_rect; |
45 SolidColorDrawQuad* replacement = | 45 SolidColorDrawQuad* replacement = |
46 quad_list.ReplaceExistingElement<SolidColorDrawQuad>(it); | 46 quad_list.ReplaceExistingElement<SolidColorDrawQuad>(it); |
47 replacement->SetAll(shared_quad_state, rect, rect, rect, false, | 47 replacement->SetAll(shared_quad_state, rect, rect, rect, false, |
48 SK_ColorTRANSPARENT, true); | 48 SK_ColorTRANSPARENT, true); |
49 candidate_list->swap(new_candidate_list); | 49 candidate_list->swap(new_candidate_list); |
| 50 |
| 51 // This quad will be promoted. We clear the promotable hints here, since |
| 52 // we can only promote a single quad. Otherwise, somebody might try to |
| 53 // back one of the promotable quads with a SurfaceView, and either it or |
| 54 // |candidate| would have to fall back to a texture. |
| 55 candidate_list->promotable_resource_hints_.clear(); |
| 56 candidate_list->promotable_resource_hints_.insert(candidate.resource_id); |
50 return true; | 57 return true; |
| 58 } else { |
| 59 // If |candidate| should get a promotion hint, then rememeber that now. |
| 60 candidate_list->promotable_resource_hints_.insert( |
| 61 new_candidate_list.promotable_resource_hints_.begin(), |
| 62 new_candidate_list.promotable_resource_hints_.end()); |
51 } | 63 } |
52 } | 64 } |
53 | 65 |
54 return false; | 66 return false; |
55 } | 67 } |
56 | 68 |
57 } // namespace cc | 69 } // namespace cc |
OLD | NEW |