| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_sandwich.h" | 5 #include "cc/output/overlay_strategy_sandwich.h" |
| 6 | 6 |
| 7 #include "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
| 8 #include "cc/base/region.h" | 8 #include "cc/base/region.h" |
| 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 22 matching lines...) Expand all Loading... |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 OverlayStrategySandwich::OverlayStrategySandwich( | 35 OverlayStrategySandwich::OverlayStrategySandwich( |
| 36 OverlayCandidateValidator* capability_checker) | 36 OverlayCandidateValidator* capability_checker) |
| 37 : capability_checker_(capability_checker) { | 37 : capability_checker_(capability_checker) { |
| 38 DCHECK(capability_checker); | 38 DCHECK(capability_checker); |
| 39 } | 39 } |
| 40 | 40 |
| 41 OverlayStrategySandwich::~OverlayStrategySandwich() {} | 41 OverlayStrategySandwich::~OverlayStrategySandwich() {} |
| 42 | 42 |
| 43 bool OverlayStrategySandwich::Attempt(RenderPassList* render_passes, | 43 bool OverlayStrategySandwich::Attempt(ResourceProvider* resource_provider, |
| 44 RenderPassList* render_passes, |
| 44 OverlayCandidateList* candidate_list) { | 45 OverlayCandidateList* candidate_list) { |
| 45 QuadList& quad_list = render_passes->back()->quad_list; | 46 QuadList& quad_list = render_passes->back()->quad_list; |
| 46 for (auto it = quad_list.begin(); it != quad_list.end();) { | 47 for (auto it = quad_list.begin(); it != quad_list.end();) { |
| 47 OverlayCandidate candidate; | 48 OverlayCandidate candidate; |
| 48 if (OverlayCandidate::FromDrawQuad(*it, &candidate)) | 49 if (OverlayCandidate::FromDrawQuad(resource_provider, *it, &candidate)) |
| 49 it = TryOverlay(render_passes->back(), candidate_list, candidate, it); | 50 it = TryOverlay(render_passes->back(), candidate_list, candidate, it); |
| 50 else | 51 else |
| 51 ++it; | 52 ++it; |
| 52 } | 53 } |
| 53 | 54 |
| 54 return candidate_list->size() > 1; | 55 return candidate_list->size() > 1; |
| 55 } | 56 } |
| 56 | 57 |
| 57 QuadList::Iterator OverlayStrategySandwich::TryOverlay( | 58 QuadList::Iterator OverlayStrategySandwich::TryOverlay( |
| 58 RenderPass* render_pass, | 59 RenderPass* render_pass, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 SK_ColorTRANSPARENT, true); | 172 SK_ColorTRANSPARENT, true); |
| 172 ++candidate_iter_in_quad_list; | 173 ++candidate_iter_in_quad_list; |
| 173 } | 174 } |
| 174 } | 175 } |
| 175 | 176 |
| 176 candidate_list->swap(new_candidate_list); | 177 candidate_list->swap(new_candidate_list); |
| 177 return candidate_iter_in_quad_list; | 178 return candidate_iter_in_quad_list; |
| 178 } | 179 } |
| 179 | 180 |
| 180 } // namespace cc | 181 } // namespace cc |
| OLD | NEW |