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

Side by Side Diff: components/display_compositor/compositor_overlay_candidate_validator_ozone.cc

Issue 2745143003: cc: Make OverlayCandidate use gfx::BufferFormat instead of cc::ResourceFormat. (Closed)
Patch Set: Created 3 years, 9 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_candidate.cc ('k') | no next file » | 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 "components/display_compositor/compositor_overlay_candidate_validator_o zone.h" 5 #include "components/display_compositor/compositor_overlay_candidate_validator_o zone.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 11 matching lines...) Expand all
22 // Templated function used to create an OverlayProcessor::Strategy 22 // Templated function used to create an OverlayProcessor::Strategy
23 // of type |S|. 23 // of type |S|.
24 template <typename S> 24 template <typename S>
25 std::unique_ptr<cc::OverlayProcessor::Strategy> MakeOverlayStrategy( 25 std::unique_ptr<cc::OverlayProcessor::Strategy> MakeOverlayStrategy(
26 CompositorOverlayCandidateValidatorOzone* capability_checker) { 26 CompositorOverlayCandidateValidatorOzone* capability_checker) {
27 return base::MakeUnique<S>(capability_checker); 27 return base::MakeUnique<S>(capability_checker);
28 } 28 }
29 29
30 } // namespace 30 } // namespace
31 31
32 static gfx::BufferFormat GetBufferFormat(cc::ResourceFormat overlay_format) {
33 switch (overlay_format) {
34 // TODO(dshwang): overlay video still uses RGBA_8888.
35 case cc::RGBA_8888:
36 case cc::BGRA_8888:
37 return gfx::BufferFormat::BGRA_8888;
38 default:
39 NOTREACHED();
40 return gfx::BufferFormat::BGRA_8888;
41 }
42 }
43
44 // |overlay_candidates| is an object used to answer questions about possible 32 // |overlay_candidates| is an object used to answer questions about possible
45 // overlays configuarations. 33 // overlays configuarations.
46 // |strategies_string| is a comma-separated string containing all the overaly 34 // |strategies_string| is a comma-separated string containing all the overaly
47 // strategies that should be returned by GetStrategies. 35 // strategies that should be returned by GetStrategies.
48 // If |strategies_string| is empty "single-on-top,underlay" will be used as 36 // If |strategies_string| is empty "single-on-top,underlay" will be used as
49 // default. 37 // default.
50 CompositorOverlayCandidateValidatorOzone:: 38 CompositorOverlayCandidateValidatorOzone::
51 CompositorOverlayCandidateValidatorOzone( 39 CompositorOverlayCandidateValidatorOzone(
52 std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates, 40 std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates,
53 std::string strategies_string) 41 std::string strategies_string)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 92 }
105 return; 93 return;
106 } 94 }
107 95
108 DCHECK_GE(2U, surfaces->size()); 96 DCHECK_GE(2U, surfaces->size());
109 ui::OverlayCandidatesOzone::OverlaySurfaceCandidateList ozone_surface_list; 97 ui::OverlayCandidatesOzone::OverlaySurfaceCandidateList ozone_surface_list;
110 ozone_surface_list.resize(surfaces->size()); 98 ozone_surface_list.resize(surfaces->size());
111 99
112 for (size_t i = 0; i < surfaces->size(); i++) { 100 for (size_t i = 0; i < surfaces->size(); i++) {
113 ozone_surface_list.at(i).transform = surfaces->at(i).transform; 101 ozone_surface_list.at(i).transform = surfaces->at(i).transform;
114 ozone_surface_list.at(i).format = GetBufferFormat(surfaces->at(i).format); 102 ozone_surface_list.at(i).format = surfaces->at(i).format;
115 ozone_surface_list.at(i).display_rect = surfaces->at(i).display_rect; 103 ozone_surface_list.at(i).display_rect = surfaces->at(i).display_rect;
116 ozone_surface_list.at(i).crop_rect = surfaces->at(i).uv_rect; 104 ozone_surface_list.at(i).crop_rect = surfaces->at(i).uv_rect;
117 ozone_surface_list.at(i).quad_rect_in_target_space = 105 ozone_surface_list.at(i).quad_rect_in_target_space =
118 surfaces->at(i).quad_rect_in_target_space; 106 surfaces->at(i).quad_rect_in_target_space;
119 ozone_surface_list.at(i).clip_rect = surfaces->at(i).clip_rect; 107 ozone_surface_list.at(i).clip_rect = surfaces->at(i).clip_rect;
120 ozone_surface_list.at(i).is_clipped = surfaces->at(i).is_clipped; 108 ozone_surface_list.at(i).is_clipped = surfaces->at(i).is_clipped;
121 ozone_surface_list.at(i).plane_z_order = surfaces->at(i).plane_z_order; 109 ozone_surface_list.at(i).plane_z_order = surfaces->at(i).plane_z_order;
122 ozone_surface_list.at(i).buffer_size = 110 ozone_surface_list.at(i).buffer_size =
123 surfaces->at(i).resource_size_in_pixels; 111 surfaces->at(i).resource_size_in_pixels;
124 } 112 }
125 113
126 overlay_candidates_->CheckOverlaySupport(&ozone_surface_list); 114 overlay_candidates_->CheckOverlaySupport(&ozone_surface_list);
127 DCHECK_EQ(surfaces->size(), ozone_surface_list.size()); 115 DCHECK_EQ(surfaces->size(), ozone_surface_list.size());
128 116
129 for (size_t i = 0; i < surfaces->size(); i++) { 117 for (size_t i = 0; i < surfaces->size(); i++) {
130 surfaces->at(i).overlay_handled = ozone_surface_list.at(i).overlay_handled; 118 surfaces->at(i).overlay_handled = ozone_surface_list.at(i).overlay_handled;
131 surfaces->at(i).display_rect = ozone_surface_list.at(i).display_rect; 119 surfaces->at(i).display_rect = ozone_surface_list.at(i).display_rect;
132 } 120 }
133 } 121 }
134 122
135 void CompositorOverlayCandidateValidatorOzone::SetSoftwareMirrorMode( 123 void CompositorOverlayCandidateValidatorOzone::SetSoftwareMirrorMode(
136 bool enabled) { 124 bool enabled) {
137 software_mirror_active_ = enabled; 125 software_mirror_active_ = enabled;
138 } 126 }
139 127
140 } // namespace display_compositor 128 } // namespace display_compositor
OLDNEW
« no previous file with comments | « cc/output/overlay_candidate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698