1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_GFX_MOJOM_HDR_METADATA_MOJOM_TRAITS_H_
#define UI_GFX_MOJOM_HDR_METADATA_MOJOM_TRAITS_H_
#include "third_party/skia/include/core/SkData.h"
#include "ui/gfx/hdr_metadata.h"
#include "ui/gfx/mojom/hdr_metadata.mojom.h"
namespace mojo {
template <>
struct StructTraits<gfx::mojom::HdrMetadataCta861_3DataView,
gfx::HdrMetadataCta861_3> {
static unsigned max_content_light_level(
const gfx::HdrMetadataCta861_3& input) {
return input.max_content_light_level;
}
static unsigned max_frame_average_light_level(
const gfx::HdrMetadataCta861_3& input) {
return input.max_frame_average_light_level;
}
static bool Read(gfx::mojom::HdrMetadataCta861_3DataView data,
gfx::HdrMetadataCta861_3* output);
};
template <>
struct StructTraits<gfx::mojom::HdrMetadataSmpteSt2086DataView,
gfx::HdrMetadataSmpteSt2086> {
static const SkColorSpacePrimaries& primaries(
const gfx::HdrMetadataSmpteSt2086& input) {
return input.primaries;
}
static float luminance_max(const gfx::HdrMetadataSmpteSt2086& input) {
return input.luminance_max;
}
static float luminance_min(const gfx::HdrMetadataSmpteSt2086& input) {
return input.luminance_min;
}
static bool Read(gfx::mojom::HdrMetadataSmpteSt2086DataView data,
gfx::HdrMetadataSmpteSt2086* output);
};
template <>
struct StructTraits<gfx::mojom::HdrMetadataNdwlDataView, gfx::HdrMetadataNdwl> {
static float nits(const gfx::HdrMetadataNdwl& input) { return input.nits; }
static bool Read(gfx::mojom::HdrMetadataNdwlDataView data,
gfx::HdrMetadataNdwl* output);
};
template <>
struct StructTraits<gfx::mojom::HdrMetadataExtendedRangeDataView,
gfx::HdrMetadataExtendedRange> {
static float current_headroom(const gfx::HdrMetadataExtendedRange& input) {
return input.current_headroom;
}
static float desired_headroom(const gfx::HdrMetadataExtendedRange& input) {
return input.desired_headroom;
}
static bool Read(gfx::mojom::HdrMetadataExtendedRangeDataView data,
gfx::HdrMetadataExtendedRange* output);
};
template <>
struct StructTraits<gfx::mojom::HdrMetadataAgtmDataView, gfx::HdrMetadataAgtm> {
static std::vector<uint8_t> payload(const gfx::HdrMetadataAgtm& input) {
std::vector<uint8_t> result;
if (input.payload) {
result.assign(input.payload->bytes(),
std::next(input.payload->bytes(), input.payload->size()));
}
return result;
}
static bool Read(gfx::mojom::HdrMetadataAgtmDataView data,
gfx::HdrMetadataAgtm* output);
};
template <>
struct StructTraits<gfx::mojom::HDRMetadataDataView, gfx::HDRMetadata> {
static const std::optional<gfx::HdrMetadataCta861_3>& cta_861_3(
const gfx::HDRMetadata& input) {
return input.cta_861_3;
}
static const std::optional<gfx::HdrMetadataSmpteSt2086>& smpte_st_2086(
const gfx::HDRMetadata& input) {
return input.smpte_st_2086;
}
static const std::optional<gfx::HdrMetadataNdwl>& ndwl(
const gfx::HDRMetadata& input) {
return input.ndwl;
}
static const std::optional<gfx::HdrMetadataExtendedRange>& extended_range(
const gfx::HDRMetadata& input) {
return input.extended_range;
}
static const std::optional<gfx::HdrMetadataAgtm>& agtm(
const gfx::HDRMetadata& input) {
return input.agtm;
}
static bool Read(gfx::mojom::HDRMetadataDataView data,
gfx::HDRMetadata* output);
};
} // namespace mojo
#endif // UI_GFX_MOJOM_HDR_METADATA_MOJOM_TRAITS_H_
|