OLD | NEW |
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 "content/browser/compositor/overlay_candidate_validator_ozone.h" | 5 #include "content/browser/compositor/overlay_candidate_validator_ozone.h" |
6 | 6 |
7 #include "ui/gfx/ozone/overlay_candidates_ozone.h" | 7 #include "ui/ozone/public/overlay_candidates_ozone.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
11 static gfx::SurfaceFactoryOzone::BufferFormat GetOzoneFormat( | 11 static ui::SurfaceFactoryOzone::BufferFormat GetOzoneFormat( |
12 cc::ResourceFormat overlay_format) { | 12 cc::ResourceFormat overlay_format) { |
13 switch (overlay_format) { | 13 switch (overlay_format) { |
14 case cc::RGBA_8888: | 14 case cc::RGBA_8888: |
15 return gfx::SurfaceFactoryOzone::RGBA_8888; | 15 return ui::SurfaceFactoryOzone::RGBA_8888; |
16 case cc::RGBA_4444: | 16 case cc::RGBA_4444: |
17 case cc::BGRA_8888: | 17 case cc::BGRA_8888: |
18 case cc::LUMINANCE_8: | 18 case cc::LUMINANCE_8: |
19 case cc::RGB_565: | 19 case cc::RGB_565: |
20 case cc::ETC1: | 20 case cc::ETC1: |
21 break; | 21 break; |
22 } | 22 } |
23 NOTREACHED(); | 23 NOTREACHED(); |
24 return gfx::SurfaceFactoryOzone::UNKNOWN; | 24 return ui::SurfaceFactoryOzone::UNKNOWN; |
25 } | 25 } |
26 | 26 |
27 OverlayCandidateValidatorOzone::OverlayCandidateValidatorOzone( | 27 OverlayCandidateValidatorOzone::OverlayCandidateValidatorOzone( |
28 gfx::AcceleratedWidget widget, | 28 gfx::AcceleratedWidget widget, |
29 gfx::OverlayCandidatesOzone* overlay_candidates) | 29 ui::OverlayCandidatesOzone* overlay_candidates) |
30 : widget_(widget), overlay_candidates_(overlay_candidates) {} | 30 : widget_(widget), overlay_candidates_(overlay_candidates) { |
| 31 } |
31 | 32 |
32 OverlayCandidateValidatorOzone::~OverlayCandidateValidatorOzone() {} | 33 OverlayCandidateValidatorOzone::~OverlayCandidateValidatorOzone() {} |
33 | 34 |
34 void OverlayCandidateValidatorOzone::CheckOverlaySupport( | 35 void OverlayCandidateValidatorOzone::CheckOverlaySupport( |
35 cc::OverlayCandidateList* surfaces) { | 36 cc::OverlayCandidateList* surfaces) { |
36 DCHECK_GE(2U, surfaces->size()); | 37 DCHECK_GE(2U, surfaces->size()); |
37 gfx::OverlayCandidatesOzone::OverlaySurfaceCandidateList ozone_surface_list; | 38 ui::OverlayCandidatesOzone::OverlaySurfaceCandidateList ozone_surface_list; |
38 ozone_surface_list.resize(surfaces->size()); | 39 ozone_surface_list.resize(surfaces->size()); |
39 | 40 |
40 for (size_t i = 0; i < surfaces->size(); i++) { | 41 for (size_t i = 0; i < surfaces->size(); i++) { |
41 ozone_surface_list.at(i).transform = surfaces->at(i).transform; | 42 ozone_surface_list.at(i).transform = surfaces->at(i).transform; |
42 ozone_surface_list.at(i).format = GetOzoneFormat(surfaces->at(i).format); | 43 ozone_surface_list.at(i).format = GetOzoneFormat(surfaces->at(i).format); |
43 ozone_surface_list.at(i).display_rect = surfaces->at(i).display_rect; | 44 ozone_surface_list.at(i).display_rect = surfaces->at(i).display_rect; |
44 ozone_surface_list.at(i).crop_rect = surfaces->at(i).uv_rect; | 45 ozone_surface_list.at(i).crop_rect = surfaces->at(i).uv_rect; |
45 ozone_surface_list.at(i).plane_z_order = surfaces->at(i).plane_z_order; | 46 ozone_surface_list.at(i).plane_z_order = surfaces->at(i).plane_z_order; |
46 } | 47 } |
47 | 48 |
48 overlay_candidates_->CheckOverlaySupport(&ozone_surface_list); | 49 overlay_candidates_->CheckOverlaySupport(&ozone_surface_list); |
49 DCHECK_EQ(surfaces->size(), ozone_surface_list.size()); | 50 DCHECK_EQ(surfaces->size(), ozone_surface_list.size()); |
50 | 51 |
51 for (size_t i = 0; i < surfaces->size(); i++) { | 52 for (size_t i = 0; i < surfaces->size(); i++) { |
52 surfaces->at(i).overlay_handled = ozone_surface_list.at(i).overlay_handled; | 53 surfaces->at(i).overlay_handled = ozone_surface_list.at(i).overlay_handled; |
53 } | 54 } |
54 } | 55 } |
55 | 56 |
56 } // namespace content | 57 } // namespace content |
OLD | NEW |