This source file includes following definitions.
- GetOzoneFormat
- overlay_candidates_
- CheckOverlaySupport
#include "content/browser/compositor/overlay_candidate_validator_ozone.h"
#include "ui/gfx/ozone/overlay_candidates_ozone.h"
namespace content {
static gfx::SurfaceFactoryOzone::BufferFormat GetOzoneFormat(
cc::ResourceFormat overlay_format) {
switch (overlay_format) {
case cc::RGBA_8888:
return gfx::SurfaceFactoryOzone::RGBA_8888;
case cc::RGBA_4444:
case cc::BGRA_8888:
case cc::LUMINANCE_8:
case cc::RGB_565:
case cc::ETC1:
break;
}
NOTREACHED();
return gfx::SurfaceFactoryOzone::UNKNOWN;
}
OverlayCandidateValidatorOzone::OverlayCandidateValidatorOzone(
gfx::AcceleratedWidget widget,
gfx::OverlayCandidatesOzone* overlay_candidates)
: widget_(widget), overlay_candidates_(overlay_candidates) {}
OverlayCandidateValidatorOzone::~OverlayCandidateValidatorOzone() {}
void OverlayCandidateValidatorOzone::CheckOverlaySupport(
cc::OverlayCandidateList* surfaces) {
DCHECK_GE(2U, surfaces->size());
gfx::OverlayCandidatesOzone::OverlaySurfaceCandidateList ozone_surface_list;
ozone_surface_list.resize(surfaces->size());
for (size_t i = 0; i < surfaces->size(); i++) {
ozone_surface_list.at(i).transform = surfaces->at(i).transform;
ozone_surface_list.at(i).format = GetOzoneFormat(surfaces->at(i).format);
ozone_surface_list.at(i).display_rect = surfaces->at(i).display_rect;
ozone_surface_list.at(i).crop_rect = surfaces->at(i).uv_rect;
ozone_surface_list.at(i).plane_z_order = surfaces->at(i).plane_z_order;
}
overlay_candidates_->CheckOverlaySupport(&ozone_surface_list);
DCHECK_EQ(surfaces->size(), ozone_surface_list.size());
for (size_t i = 0; i < surfaces->size(); i++) {
surfaces->at(i).overlay_handled = ozone_surface_list.at(i).overlay_handled;
}
}
}