File indexing completed on 2025-03-23 11:13:32
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 #include "colorpipelinestage.h" 0010 0011 #include <lcms2.h> 0012 0013 #include "utils/common.h" 0014 0015 namespace KWin 0016 { 0017 0018 ColorPipelineStage::ColorPipelineStage(cmsStage *stage) 0019 : m_stage(stage) 0020 { 0021 } 0022 0023 ColorPipelineStage::~ColorPipelineStage() 0024 { 0025 if (m_stage) { 0026 cmsStageFree(m_stage); 0027 } 0028 } 0029 0030 std::unique_ptr<ColorPipelineStage> ColorPipelineStage::dup() const 0031 { 0032 if (m_stage) { 0033 auto dup = cmsStageDup(m_stage); 0034 if (dup) { 0035 return std::make_unique<ColorPipelineStage>(dup); 0036 } else { 0037 qCWarning(KWIN_CORE) << "Failed to duplicate cmsStage!"; 0038 } 0039 } 0040 return nullptr; 0041 } 0042 0043 cmsStage *ColorPipelineStage::stage() const 0044 { 0045 return m_stage; 0046 } 0047 0048 }