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" |
11 #include "cc/quads/stream_video_draw_quad.h" | 11 #include "cc/quads/stream_video_draw_quad.h" |
12 #include "cc/quads/texture_draw_quad.h" | 12 #include "cc/quads/texture_draw_quad.h" |
13 #include "cc/resources/resource_provider.h" | 13 #include "cc/resources/resource_provider.h" |
14 #include "ui/gfx/geometry/point3_f.h" | 14 #include "ui/gfx/geometry/point3_f.h" |
15 #include "ui/gfx/geometry/rect_conversions.h" | 15 #include "ui/gfx/geometry/rect_conversions.h" |
16 #include "ui/gfx/transform.h" | 16 #include "ui/gfx/transform.h" |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 | 19 |
20 OverlayStrategyCommon::OverlayStrategyCommon( | 20 OverlayStrategyCommon::OverlayStrategyCommon( |
21 OverlayCandidateValidator* capability_checker) | 21 OverlayCandidateValidator* capability_checker) |
22 : capability_checker_(capability_checker) { | 22 : capability_checker_(capability_checker) { |
23 } | 23 } |
24 | 24 |
25 OverlayStrategyCommon::~OverlayStrategyCommon() { | 25 OverlayStrategyCommon::~OverlayStrategyCommon() { |
26 } | 26 } |
27 | 27 |
28 bool OverlayStrategyCommon::Attempt(RenderPassList* render_passes_in_draw_order, | 28 bool OverlayStrategyCommon::Attempt( |
29 OverlayCandidateList* candidate_list) { | 29 const OverlayProcessor::RendererState& renderer_state, |
| 30 RenderPassList* render_passes_in_draw_order, |
| 31 OverlayCandidateList* candidate_list) { |
30 if (!capability_checker_) | 32 if (!capability_checker_) |
31 return false; | 33 return false; |
32 RenderPass* root_render_pass = render_passes_in_draw_order->back(); | 34 RenderPass* root_render_pass = render_passes_in_draw_order->back(); |
33 DCHECK(root_render_pass); | 35 DCHECK(root_render_pass); |
34 | 36 |
35 QuadList& quad_list = root_render_pass->quad_list; | 37 QuadList& quad_list = root_render_pass->quad_list; |
36 for (auto it = quad_list.begin(); it != quad_list.end(); ++it) { | 38 for (auto it = quad_list.begin(); it != quad_list.end(); ++it) { |
37 OverlayCandidate candidate; | 39 OverlayCandidate candidate; |
38 const DrawQuad* draw_quad = *it; | 40 const DrawQuad* draw_quad = *it; |
39 if (IsOverlayQuad(draw_quad) && | 41 if (IsOverlayQuad(draw_quad) && |
40 GetCandidateQuadInfo(*draw_quad, &candidate) && | 42 GetCandidateQuadInfo(*draw_quad, &candidate) && |
41 TryOverlay(capability_checker_, render_passes_in_draw_order, | 43 TryOverlay(renderer_state, capability_checker_, |
42 candidate_list, candidate, it)) | 44 render_passes_in_draw_order, candidate_list, candidate, it)) |
43 return true; | 45 return true; |
44 } | 46 } |
45 return false; | 47 return false; |
46 } | 48 } |
47 | 49 |
48 bool OverlayStrategyCommon::IsOverlayQuad(const DrawQuad* draw_quad) { | 50 bool OverlayStrategyCommon::IsOverlayQuad(const DrawQuad* draw_quad) { |
49 switch (draw_quad->material) { | 51 switch (draw_quad->material) { |
50 case DrawQuad::TEXTURE_CONTENT: | 52 case DrawQuad::TEXTURE_CONTENT: |
51 return TextureDrawQuad::MaterialCast(draw_quad)->allow_overlay(); | 53 return TextureDrawQuad::MaterialCast(draw_quad)->allow_overlay(); |
52 case DrawQuad::STREAM_VIDEO_CONTENT: | 54 case DrawQuad::STREAM_VIDEO_CONTENT: |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 return false; | 173 return false; |
172 } | 174 } |
173 | 175 |
174 quad_info->format = RGBA_8888; | 176 quad_info->format = RGBA_8888; |
175 quad_info->display_rect = OverlayCandidate::GetOverlayRect( | 177 quad_info->display_rect = OverlayCandidate::GetOverlayRect( |
176 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect); | 178 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect); |
177 return true; | 179 return true; |
178 } | 180 } |
179 | 181 |
180 } // namespace cc | 182 } // namespace cc |
OLD | NEW |