colors/colordevice: remove brightness factor

It's completely unused. If brightness modification is desired for night light
for example, it should be tied in with the actual brightness controls for outputs
instead
This commit is contained in:
Xaver Hugl 2024-07-15 20:52:03 +02:00
parent cb830957aa
commit 6b42e59677
2 changed files with 1 additions and 39 deletions

View file

@ -26,15 +26,9 @@ public:
Output *output;
QTimer *updateTimer;
uint brightness = 100;
uint temperature = 6500;
QVector3D temperatureFactors = QVector3D(1, 1, 1);
QVector3D brightnessFactors = QVector3D(1, 1, 1);
std::shared_ptr<ColorTransformation> transformation;
// used if only limited per-channel multiplication is available
QVector3D simpleTransformation = QVector3D(1, 1, 1);
};
static qreal interpolate(qreal a, qreal b, qreal blendFactor)
@ -44,8 +38,6 @@ static qreal interpolate(qreal a, qreal b, qreal blendFactor)
void ColorDevicePrivate::recalculateFactors()
{
brightnessFactors = QVector3D(brightness / 100.0, brightness / 100.0, brightness / 100.0);
if (temperature == 6500) {
temperatureFactors = QVector3D(1, 1, 1);
} else {
@ -65,7 +57,6 @@ void ColorDevicePrivate::recalculateFactors()
// the values in the blackbodyColor array are "gamma corrected", but we need a linear value
temperatureFactors = TransferFunction(TransferFunction::gamma22).encodedToNits(QVector3D(xWhitePoint, yWhitePoint, zWhitePoint), 1);
}
simpleTransformation = brightnessFactors * temperatureFactors;
}
ColorDevice::ColorDevice(Output *output, QObject *parent)
@ -89,25 +80,6 @@ Output *ColorDevice::output() const
return d->output;
}
uint ColorDevice::brightness() const
{
return d->brightness;
}
void ColorDevice::setBrightness(uint brightness)
{
if (brightness > 100) {
qCWarning(KWIN_CORE) << "Got invalid brightness value:" << brightness;
brightness = 100;
}
if (d->brightness == brightness) {
return;
}
d->brightness = brightness;
scheduleUpdate();
Q_EMIT brightnessChanged();
}
uint ColorDevice::temperature() const
{
return d->temperature;
@ -130,7 +102,7 @@ void ColorDevice::setTemperature(uint temperature)
void ColorDevice::update()
{
d->recalculateFactors();
d->output->setChannelFactors(d->simpleTransformation);
d->output->setChannelFactors(d->temperatureFactors);
}
void ColorDevice::scheduleUpdate()

View file

@ -33,16 +33,6 @@ public:
*/
Output *output() const;
/**
* Returns the current color brightness on this device, in percent.
*/
uint brightness() const;
/**
* Sets the color brightness on this device to @a brightness, in percent.
*/
void setBrightness(uint brightness);
/**
* Returns the current color temperature on this device, in Kelvins.
*/