// Copyright 2022 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_BASE_WAYLAND_COLOR_MANAGER_UTIL_H_ #define UI_BASE_WAYLAND_COLOR_MANAGER_UTIL_H_ #include <chrome-color-management-server-protocol.h> #include "base/containers/fixed_flat_map.h" #include "skia/ext/skcolorspace_trfn.h" #include "ui/gfx/color_space.h" #include "ui/gfx/display_color_spaces.h" namespace ui::wayland { // A 2.4 gamma for the BT2087 transfer function. static constexpr skcms_TransferFunction gamma24 = …; constexpr uint32_t kDefaultSinceVersion = …; // These structs are used for holding ColorSpace enums, and the version of the // color management protocol their support was introduced. struct TransferFnVersion { … }; struct TransferVersion { … }; struct PrimaryVersion { … }; struct MatrixVersion { … }; struct RangeVersion { … }; // A map from the zcr_color_manager_v1 chromaticity_names enum values // representing well-known chromaticities, to their equivalent PrimaryIDs. // See components/exo/wayland/protocol/chrome-color-management.xml constexpr auto kChromaticityMap = …; // A map from the zcr_color_manager_v1 eotf_names enum values // representing well-known EOTFs, to their equivalent TransferIDs. // See components/exo/wayland/protocol/chrome-color-management.xml constexpr auto kEotfMap = …; // A map from the SDR zcr_color_manager_v1 eotf_names enum values // representing well-known EOTFs, to their equivalent transfer functions. // See components/exo/wayland/protocol/chrome-color-management.xml constexpr auto kTransferMap = …; // A map from the HDR zcr_color_manager_v1 eotf_names enum values // representing well-known EOTFs, to their equivalent transfer functions. // See components/exo/wayland/protocol/chrome-color-management.xml constexpr auto kHDRTransferMap = …; // A map from zcr_color_manager_v1 matrix_names enum values to // gfx::ColorSpace::MatrixIDs. constexpr auto kMatrixMap = …; // A map from zcr_color_manager_v1 range_names enum values to // gfx::ColorSpace::RangeIDs. constexpr auto kRangeMap = …; zcr_color_manager_v1_chromaticity_names ToColorManagerChromaticity( gfx::ColorSpace::PrimaryID primaryID, uint32_t version); zcr_color_manager_v1_matrix_names ToColorManagerMatrix( gfx::ColorSpace::MatrixID matrixID, uint32_t version); zcr_color_manager_v1_range_names ToColorManagerRange( gfx::ColorSpace::RangeID rangeID, uint32_t version); zcr_color_manager_v1_eotf_names ToColorManagerEOTF( gfx::ColorSpace::TransferID transferID, uint32_t version); zcr_color_manager_v1_eotf_names ToColorManagerEOTF(gfx::ColorSpace color_space, uint32_t version); } // namespace ui::wayland #endif // UI_BASE_WAYLAND_COLOR_MANAGER_UTIL_H_