plugins/colorpicker: fix interaction with SDR brightness

Right now both source and target color descriptions have SDR brightness values,
and the target one gets used; in this case however the source brightness needs
to be used instead.

BUG: 484497
This commit is contained in:
Xaver Hugl 2024-04-05 17:53:54 +02:00
parent 2dbf2dd995
commit b29b3db26d

View file

@ -62,9 +62,10 @@ void ColorPickerEffect::paintScreen(const RenderTarget &renderTarget, const Rend
std::array<float, 4> data;
constexpr GLsizei PIXEL_SIZE = 1;
const QPoint texturePosition = viewport.mapToRenderTarget(m_scheduledPosition).toPoint();
const ColorDescription sRGBencoding(Colorimetry::fromName(NamedColorimetry::BT709), NamedTransferFunction::gamma22, renderTarget.colorDescription().sdrBrightness(), 0, renderTarget.colorDescription().sdrBrightness(), renderTarget.colorDescription().sdrBrightness());
glReadPixels(texturePosition.x(), renderTarget.size().height() - texturePosition.y() - PIXEL_SIZE, PIXEL_SIZE, PIXEL_SIZE, GL_RGBA, GL_FLOAT, data.data());
QVector3D sRGB = 255 * renderTarget.colorDescription().mapTo(QVector3D(data[0], data[1], data[2]), ColorDescription::sRGB);
QVector3D sRGB = 255 * renderTarget.colorDescription().mapTo(QVector3D(data[0], data[1], data[2]), sRGBencoding);
QDBusConnection::sessionBus().send(m_replyMessage.createReply(QColor(sRGB.x(), sRGB.y(), sRGB.z())));
m_picking = false;
m_scheduledPosition = QPoint(-1, -1);