Changeset View
Changeset View
Standalone View
Standalone View
effects/colorpicker/colorpicker.cpp
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | |||||
69 | 69 | | |||
70 | void ColorPickerEffect::postPaintScreen() | 70 | void ColorPickerEffect::postPaintScreen() | ||
71 | { | 71 | { | ||
72 | effects->postPaintScreen(); | 72 | effects->postPaintScreen(); | ||
73 | 73 | | |||
74 | if (m_scheduledPosition != QPoint(-1, -1) && (m_cachedOutputGeometry.isEmpty() || m_cachedOutputGeometry.contains(m_scheduledPosition))) { | 74 | if (m_scheduledPosition != QPoint(-1, -1) && (m_cachedOutputGeometry.isEmpty() || m_cachedOutputGeometry.contains(m_scheduledPosition))) { | ||
75 | uint8_t data[3]; | 75 | uint8_t data[3]; | ||
76 | const QRect geo = GLRenderTarget::virtualScreenGeometry(); | 76 | const QRect geo = GLRenderTarget::virtualScreenGeometry(); | ||
77 | glReadnPixels(m_scheduledPosition.x() - geo.x(), geo.height() - geo.y() - m_scheduledPosition.y(), 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 3, data); | 77 | const QPoint screenPosition(m_scheduledPosition.x() - geo.x(), m_scheduledPosition.y() - geo.y()); | ||
78 | const QPoint texturePosition(screenPosition.x() * GLRenderTarget::virtualScreenScale(), (geo.height() - screenPosition.y()) * GLRenderTarget::virtualScreenScale()); | ||||
79 | | ||||
80 | glReadnPixels(texturePosition.x(), texturePosition.y(), 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 3, data); | ||||
78 | QDBusConnection::sessionBus().send(m_replyMessage.createReply(QColor(data[0], data[1], data[2]))); | 81 | QDBusConnection::sessionBus().send(m_replyMessage.createReply(QColor(data[0], data[1], data[2]))); | ||
79 | m_picking = false; | 82 | m_picking = false; | ||
80 | m_scheduledPosition = QPoint(-1, -1); | 83 | m_scheduledPosition = QPoint(-1, -1); | ||
81 | } | 84 | } | ||
82 | } | 85 | } | ||
83 | 86 | | |||
84 | QColor ColorPickerEffect::pick() | 87 | QColor ColorPickerEffect::pick() | ||
85 | { | 88 | { | ||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |