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_common.h" | 5 #include "cc/output/overlay_strategy_common.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "cc/quads/io_surface_draw_quad.h" | 9 #include "cc/quads/io_surface_draw_quad.h" |
10 #include "cc/quads/solid_color_draw_quad.h" | 10 #include "cc/quads/solid_color_draw_quad.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 } | 26 } |
27 | 27 |
28 bool OverlayStrategyCommon::Attempt(RenderPassList* render_passes_in_draw_order, | 28 bool OverlayStrategyCommon::Attempt(RenderPassList* render_passes_in_draw_order, |
29 OverlayCandidateList* candidate_list, | 29 OverlayCandidateList* candidate_list, |
30 float device_scale_factor) { | 30 float device_scale_factor) { |
31 if (!capability_checker_) | 31 if (!capability_checker_) |
32 return false; | 32 return false; |
33 RenderPass* root_render_pass = render_passes_in_draw_order->back(); | 33 RenderPass* root_render_pass = render_passes_in_draw_order->back(); |
34 DCHECK(root_render_pass); | 34 DCHECK(root_render_pass); |
35 | 35 |
36 // Add our primary surface. | |
37 OverlayCandidate main_image; | |
38 main_image.display_rect = root_render_pass->output_rect; | |
39 DCHECK(candidate_list->empty()); | |
40 candidate_list->push_back(main_image); | |
41 | |
42 bool success = false; | |
36 QuadList& quad_list = root_render_pass->quad_list; | 43 QuadList& quad_list = root_render_pass->quad_list; |
37 for (auto it = quad_list.begin(); it != quad_list.end(); ++it) { | 44 for (auto it = quad_list.begin(); it != quad_list.end();) { |
38 OverlayCandidate candidate; | 45 OverlayCandidate candidate; |
39 const DrawQuad* draw_quad = *it; | 46 const DrawQuad* draw_quad = *it; |
40 if (IsOverlayQuad(draw_quad) && | 47 if (IsOverlayQuad(draw_quad) && |
41 GetCandidateQuadInfo(*draw_quad, &candidate) && | 48 GetCandidateQuadInfo(*draw_quad, &candidate)) { |
42 delegate_->TryOverlay(capability_checker_, render_passes_in_draw_order, | 49 OverlayResult result = delegate_->TryOverlay( |
43 candidate_list, candidate, it, | 50 capability_checker_, render_passes_in_draw_order, candidate_list, |
44 device_scale_factor)) | 51 candidate, &it, device_scale_factor); |
45 return true; | 52 if (result == CREATED_OVERLAY_STOP_LOOKING) { |
53 return true; | |
alexst (slow to review)
2015/09/04 15:32:10
This is a little weird because on this path you do
Andre
2015/09/04 17:22:47
Done.
| |
54 } else if (result == CREATED_OVERLAY_KEEP_LOOKING) { | |
55 success = true; | |
56 continue; | |
57 } | |
58 } | |
59 ++it; | |
46 } | 60 } |
47 return false; | 61 |
62 if (!success) { | |
63 DCHECK_EQ(1u, candidate_list->size()); | |
64 candidate_list->clear(); | |
65 } | |
66 | |
67 return success; | |
48 } | 68 } |
49 | 69 |
50 bool OverlayStrategyCommon::IsOverlayQuad(const DrawQuad* draw_quad) { | 70 bool OverlayStrategyCommon::IsOverlayQuad(const DrawQuad* draw_quad) { |
51 switch (draw_quad->material) { | 71 switch (draw_quad->material) { |
52 case DrawQuad::TEXTURE_CONTENT: | 72 case DrawQuad::TEXTURE_CONTENT: |
53 return TextureDrawQuad::MaterialCast(draw_quad)->allow_overlay(); | 73 return TextureDrawQuad::MaterialCast(draw_quad)->allow_overlay(); |
54 case DrawQuad::STREAM_VIDEO_CONTENT: | 74 case DrawQuad::STREAM_VIDEO_CONTENT: |
55 return StreamVideoDrawQuad::MaterialCast(draw_quad)->allow_overlay(); | 75 return StreamVideoDrawQuad::MaterialCast(draw_quad)->allow_overlay(); |
56 case DrawQuad::IO_SURFACE_CONTENT: | 76 case DrawQuad::IO_SURFACE_CONTENT: |
57 return IOSurfaceDrawQuad::MaterialCast(draw_quad)->allow_overlay; | 77 return IOSurfaceDrawQuad::MaterialCast(draw_quad)->allow_overlay; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 return false; | 194 return false; |
175 } | 195 } |
176 | 196 |
177 quad_info->format = RGBA_8888; | 197 quad_info->format = RGBA_8888; |
178 quad_info->display_rect = OverlayCandidate::GetOverlayRect( | 198 quad_info->display_rect = OverlayCandidate::GetOverlayRect( |
179 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect); | 199 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect); |
180 return true; | 200 return true; |
181 } | 201 } |
182 | 202 |
183 } // namespace cc | 203 } // namespace cc |
OLD | NEW |