Commit 420636a2 authored by ivan tkachenko's avatar ivan tkachenko Committed by Nate Graham
Browse files

effects/colorpicker: Fix picking colors



Due to the wrong buffer format, the function failed with
GL_INVALID_OPERATION error, which was silently ignored by the effect.
It resulted in the constant phantom color being returned over and over
again.
Co-Authored-By: David Edmundson's avatarDavid Edmundson <kde@davidedmundson.co.uk>
BUG: 454974
FIXED-IN: 5.24.7, 5.25.4, 5.26


(cherry picked from commit df6331b6)
parent ea28596a
Pipeline #207872 passed with stage
in 21 minutes and 31 seconds
......@@ -55,12 +55,12 @@ void ColorPickerEffect::paintScreen(int mask, const QRegion &region, ScreenPaint
effects->paintScreen(mask, region, data);
if (m_scheduledPosition != QPoint(-1, -1) && effects->renderTargetRect().contains(m_scheduledPosition)) {
uint8_t data[3];
uint8_t data[4];
const QRect geo = effects->renderTargetRect();
const QPoint screenPosition(m_scheduledPosition.x() - geo.x(), m_scheduledPosition.y() - geo.y());
const QPoint texturePosition(screenPosition.x() * effects->renderTargetScale(), (geo.height() - screenPosition.y()) * effects->renderTargetScale());
glReadnPixels(texturePosition.x(), texturePosition.y(), 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 3, data);
glReadnPixels(texturePosition.x(), texturePosition.y(), 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 4, data);
QDBusConnection::sessionBus().send(m_replyMessage.createReply(QColor(data[0], data[1], data[2])));
m_picking = false;
m_scheduledPosition = QPoint(-1, -1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment