Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: cc/output/overlay_strategy_common.cc

Issue 1304053016: Mac Overlays: Allow multiple overlays with sandwich strategy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snapshot
Patch Set: For alexst Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/overlay_strategy_common.h ('k') | cc/output/overlay_strategy_sandwich.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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) {
alexst (slow to review) 2015/09/04 17:53:57 Actually, one more thought, we don't handle DID_NO
Andre 2015/09/08 16:55:36 Done. The combination of continue (for the loop) a
53 success = true;
54 break;
55 } else if (result == CREATED_OVERLAY_KEEP_LOOKING) {
56 success = true;
57 continue;
58 }
59 }
60 ++it;
46 } 61 }
47 return false; 62
63 if (!success) {
64 DCHECK_EQ(1u, candidate_list->size());
65 candidate_list->clear();
66 }
67
68 return success;
48 } 69 }
49 70
50 bool OverlayStrategyCommon::IsOverlayQuad(const DrawQuad* draw_quad) { 71 bool OverlayStrategyCommon::IsOverlayQuad(const DrawQuad* draw_quad) {
51 switch (draw_quad->material) { 72 switch (draw_quad->material) {
52 case DrawQuad::TEXTURE_CONTENT: 73 case DrawQuad::TEXTURE_CONTENT:
53 return TextureDrawQuad::MaterialCast(draw_quad)->allow_overlay(); 74 return TextureDrawQuad::MaterialCast(draw_quad)->allow_overlay();
54 case DrawQuad::STREAM_VIDEO_CONTENT: 75 case DrawQuad::STREAM_VIDEO_CONTENT:
55 return StreamVideoDrawQuad::MaterialCast(draw_quad)->allow_overlay(); 76 return StreamVideoDrawQuad::MaterialCast(draw_quad)->allow_overlay();
56 case DrawQuad::IO_SURFACE_CONTENT: 77 case DrawQuad::IO_SURFACE_CONTENT:
57 return IOSurfaceDrawQuad::MaterialCast(draw_quad)->allow_overlay; 78 return IOSurfaceDrawQuad::MaterialCast(draw_quad)->allow_overlay;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return false; 195 return false;
175 } 196 }
176 197
177 quad_info->format = RGBA_8888; 198 quad_info->format = RGBA_8888;
178 quad_info->display_rect = OverlayCandidate::GetOverlayRect( 199 quad_info->display_rect = OverlayCandidate::GetOverlayRect(
179 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect); 200 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect);
180 return true; 201 return true;
181 } 202 }
182 203
183 } // namespace cc 204 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/overlay_strategy_common.h ('k') | cc/output/overlay_strategy_sandwich.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698