KWin
Loading...
Searching...
No Matches
x11_standalone_output.cpp
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
10#include "core/colorlut.h"
12#include "main.h"
14
15namespace KWin
16{
17
19 : Output(parent)
20 , m_backend(backend)
21{
22}
23
25{
26 return m_loop;
27}
28
30{
31 m_loop = loop;
32}
33
35{
36 return m_xineramaNumber;
37}
38
40{
41 m_xineramaNumber = number;
42}
43
44bool X11Output::setChannelFactors(const QVector3D &rgb)
45{
46 if (m_crtc == XCB_NONE) {
47 return true;
48 }
50 if (!transformation) {
51 return false;
52 }
53 ColorLUT lut(std::move(transformation), m_gammaRampSize);
54 xcb_randr_set_crtc_gamma(kwinApp()->x11Connection(), m_crtc, lut.size(), lut.red(), lut.green(), lut.blue());
55 return true;
56}
57
58void X11Output::setCrtc(xcb_randr_crtc_t crtc)
59{
60 m_crtc = crtc;
61}
62
63void X11Output::setGammaRampSize(int size)
64{
65 m_gammaRampSize = size;
66}
67
68void X11Output::updateEnabled(bool enabled)
69{
70 State next = m_state;
71 next.enabled = enabled;
72 setState(next);
73}
74
75} // namespace KWin
76
77#include "moc_x11_standalone_output.cpp"
static QVector3D nitsToEncoded(const QVector3D &rgb, NamedTransferFunction tf, double sdrBrightness)
uint16_t * blue() const
Definition colorlut.cpp:36
uint16_t * red() const
Definition colorlut.cpp:26
size_t size() const
Definition colorlut.cpp:41
uint16_t * green() const
Definition colorlut.cpp:31
static std::unique_ptr< ColorTransformation > createScalingTransform(const QVector3D &scale)
void setState(const State &state)
Definition output.cpp:562
State m_state
Definition output.h:477
RenderLoop * renderLoop() const override
void setRenderLoop(RenderLoop *loop)
X11Output(X11StandaloneBackend *backend, QObject *parent=nullptr)
bool setChannelFactors(const QVector3D &rgb) override
void updateEnabled(bool enabled)
void setXineramaNumber(int number)