File indexing completed on 2024-05-12 05:32:21
0001 /* 0002 SPDX-FileCopyrightText: 2023 Xaver Hugl <xaver.hugl@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 #pragma once 0007 0008 #include "core/colorspace.h" 0009 #include "wayland/qwayland-server-frog-color-management-v1.h" 0010 0011 #include <QObject> 0012 #include <QPointer> 0013 0014 namespace KWin 0015 { 0016 0017 class Display; 0018 class SurfaceInterface; 0019 0020 class FrogColorManagementV1 : public QObject, private QtWaylandServer::frog_color_management_factory_v1 0021 { 0022 Q_OBJECT 0023 public: 0024 explicit FrogColorManagementV1(Display *display, QObject *parent); 0025 ~FrogColorManagementV1() override; 0026 0027 private: 0028 void frog_color_management_factory_v1_get_color_managed_surface(Resource *resource, wl_resource *surface, uint32_t callback) override; 0029 void frog_color_management_factory_v1_destroy(Resource *resource) override; 0030 }; 0031 0032 class FrogColorManagementSurfaceV1 : public QObject, private QtWaylandServer::frog_color_managed_surface 0033 { 0034 Q_OBJECT 0035 public: 0036 explicit FrogColorManagementSurfaceV1(SurfaceInterface *surface, wl_client *client, uint32_t id); 0037 ~FrogColorManagementSurfaceV1() override; 0038 0039 void setPreferredColorDescription(const ColorDescription &colorDescription); 0040 0041 private: 0042 void frog_color_managed_surface_set_known_transfer_function(Resource *resource, uint32_t transfer_function) override; 0043 void frog_color_managed_surface_set_known_container_color_volume(Resource *resource, uint32_t primaries) override; 0044 void frog_color_managed_surface_set_render_intent(Resource *resource, uint32_t render_intent) override; 0045 void frog_color_managed_surface_set_hdr_metadata(Resource *resource, uint32_t mastering_display_primary_red_x, uint32_t mastering_display_primary_red_y, 0046 uint32_t mastering_display_primary_green_x, uint32_t mastering_display_primary_green_y, 0047 uint32_t mastering_display_primary_blue_x, uint32_t mastering_display_primary_blue_y, 0048 uint32_t mastering_white_point_x, uint32_t mastering_white_point_y, 0049 uint32_t max_display_mastering_luminance, uint32_t min_display_mastering_luminance, 0050 uint32_t max_cll, uint32_t max_fall) override; 0051 void frog_color_managed_surface_destroy(Resource *resource) override; 0052 void frog_color_managed_surface_destroy_resource(Resource *resource) override; 0053 void updateColorDescription(); 0054 0055 const QPointer<SurfaceInterface> m_surface; 0056 NamedTransferFunction m_transferFunction = NamedTransferFunction::sRGB; 0057 NamedColorimetry m_colorimetry = NamedColorimetry::BT709; 0058 float m_maxFrameAverageBrightness = 0; 0059 float m_maxPeakBrightness = 0; 0060 }; 0061 0062 }