diff --git a/src/effects/colorpicker/colorpicker.cpp b/src/effects/colorpicker/colorpicker.cpp index d0b66c46b0..dd99229723 100644 --- a/src/effects/colorpicker/colorpicker.cpp +++ b/src/effects/colorpicker/colorpicker.cpp @@ -57,10 +57,11 @@ void ColorPickerEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaint const QRect geo = effects->renderTargetRect(); if (m_scheduledPosition != QPoint(-1, -1) && geo.contains(m_scheduledPosition)) { uint8_t data[4]; + constexpr GLsizei PIXEL_SIZE = 1; 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()); + const QPoint texturePosition(screenPosition.x() * effects->renderTargetScale(), (geo.height() - screenPosition.y() - PIXEL_SIZE) * effects->renderTargetScale()); - glReadnPixels(texturePosition.x(), texturePosition.y(), 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 4, data); + glReadnPixels(texturePosition.x(), texturePosition.y(), PIXEL_SIZE, PIXEL_SIZE, 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);