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

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

Issue 1380653003: Mac Overlays: Allow SolidColor and Tile quads to be candidates for overlays. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@AllOrNothing2
Patch Set: Created 5 years, 2 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_single_on_top.cc ('k') | cc/output/overlay_unittest.cc » ('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 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
11 namespace cc { 11 namespace cc {
12 12
13 OverlayStrategyUnderlay::OverlayStrategyUnderlay( 13 OverlayStrategyUnderlay::OverlayStrategyUnderlay(
14 OverlayCandidateValidator* capability_checker) 14 OverlayCandidateValidator* capability_checker)
15 : capability_checker_(capability_checker) { 15 : capability_checker_(capability_checker) {
16 DCHECK(capability_checker); 16 DCHECK(capability_checker);
17 } 17 }
18 18
19 OverlayStrategyUnderlay::~OverlayStrategyUnderlay() {} 19 OverlayStrategyUnderlay::~OverlayStrategyUnderlay() {}
20 20
21 bool OverlayStrategyUnderlay::Attempt(ResourceProvider* resource_provider, 21 bool OverlayStrategyUnderlay::Attempt(ResourceProvider* resource_provider,
22 RenderPassList* render_passes, 22 RenderPassList* render_passes,
23 OverlayCandidateList* candidate_list) { 23 OverlayCandidateList* candidate_list) {
24 QuadList& quad_list = render_passes->back()->quad_list; 24 QuadList& quad_list = render_passes->back()->quad_list;
25 for (auto it = quad_list.begin(); it != quad_list.end(); ++it) { 25 for (auto it = quad_list.begin(); it != quad_list.end(); ++it) {
26 OverlayCandidate candidate; 26 OverlayCandidate candidate;
27 if (!OverlayCandidate::FromDrawQuad(resource_provider, *it, &candidate)) 27 if (!capability_checker_->IsSupportedQuad(*it) ||
28 !OverlayCandidate::FromDrawQuad(resource_provider, *it, &candidate))
28 continue; 29 continue;
29 30
30 // Add the overlay. 31 // Add the overlay.
31 OverlayCandidateList new_candidate_list = *candidate_list; 32 OverlayCandidateList new_candidate_list = *candidate_list;
32 new_candidate_list.push_back(candidate); 33 new_candidate_list.push_back(candidate);
33 new_candidate_list.back().plane_z_order = -1; 34 new_candidate_list.back().plane_z_order = -1;
34 35
35 // Check for support. 36 // Check for support.
36 capability_checker_->CheckOverlaySupport(&new_candidate_list); 37 capability_checker_->CheckOverlaySupport(&new_candidate_list);
37 38
38 // If the candidate can be handled by an overlay, create a pass for it. We 39 // If the candidate can be handled by an overlay, create a pass for it. We
39 // need to switch out the video quad with a black transparent one. 40 // need to switch out the video quad with a black transparent one.
40 if (new_candidate_list.back().overlay_handled) { 41 if (new_candidate_list.back().overlay_handled) {
41 const SharedQuadState* shared_quad_state = it->shared_quad_state; 42 const SharedQuadState* shared_quad_state = it->shared_quad_state;
42 gfx::Rect rect = it->visible_rect; 43 gfx::Rect rect = it->visible_rect;
43 SolidColorDrawQuad* replacement = 44 SolidColorDrawQuad* replacement =
44 quad_list.ReplaceExistingElement<SolidColorDrawQuad>(it); 45 quad_list.ReplaceExistingElement<SolidColorDrawQuad>(it);
45 replacement->SetAll(shared_quad_state, rect, rect, rect, false, 46 replacement->SetAll(shared_quad_state, rect, rect, rect, false,
46 SK_ColorTRANSPARENT, true); 47 SK_ColorTRANSPARENT, true);
47 candidate_list->swap(new_candidate_list); 48 candidate_list->swap(new_candidate_list);
48 return true; 49 return true;
49 } 50 }
50 } 51 }
51 52
52 return false; 53 return false;
53 } 54 }
54 55
55 } // namespace cc 56 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/overlay_strategy_single_on_top.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698