Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / content / browser / compositor / overlay_candidate_validator_ozone.cc
bloba92dc1011ded70bbd7aa00b5ea16e4fe46e22cb0
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
3 // found in the LICENSE file.
5 #include "content/browser/compositor/overlay_candidate_validator_ozone.h"
7 #include "ui/ozone/public/overlay_candidates_ozone.h"
9 namespace content {
11 static ui::SurfaceFactoryOzone::BufferFormat GetOzoneFormat(
12 cc::ResourceFormat overlay_format) {
13 switch (overlay_format) {
14 case cc::RGBA_8888:
15 return ui::SurfaceFactoryOzone::RGBA_8888;
16 case cc::RGBA_4444:
17 case cc::BGRA_8888:
18 case cc::ALPHA_8:
19 case cc::LUMINANCE_8:
20 case cc::RGB_565:
21 case cc::ETC1:
22 break;
24 NOTREACHED();
25 return ui::SurfaceFactoryOzone::UNKNOWN;
28 OverlayCandidateValidatorOzone::OverlayCandidateValidatorOzone(
29 gfx::AcceleratedWidget widget,
30 ui::OverlayCandidatesOzone* overlay_candidates)
31 : widget_(widget), overlay_candidates_(overlay_candidates) {
34 OverlayCandidateValidatorOzone::~OverlayCandidateValidatorOzone() {}
36 void OverlayCandidateValidatorOzone::CheckOverlaySupport(
37 cc::OverlayCandidateList* surfaces) {
38 DCHECK_GE(2U, surfaces->size());
39 ui::OverlayCandidatesOzone::OverlaySurfaceCandidateList ozone_surface_list;
40 ozone_surface_list.resize(surfaces->size());
42 for (size_t i = 0; i < surfaces->size(); i++) {
43 ozone_surface_list.at(i).transform = surfaces->at(i).transform;
44 ozone_surface_list.at(i).format = GetOzoneFormat(surfaces->at(i).format);
45 ozone_surface_list.at(i).display_rect = surfaces->at(i).display_rect;
46 ozone_surface_list.at(i).crop_rect = surfaces->at(i).uv_rect;
47 ozone_surface_list.at(i).plane_z_order = surfaces->at(i).plane_z_order;
50 overlay_candidates_->CheckOverlaySupport(&ozone_surface_list);
51 DCHECK_EQ(surfaces->size(), ozone_surface_list.size());
53 for (size_t i = 0; i < surfaces->size(); i++) {
54 surfaces->at(i).overlay_handled = ozone_surface_list.at(i).overlay_handled;
58 } // namespace content