Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_output.cpp
Show First 20 Lines • Show All 126 Lines • ▼ Show 20 Line(s) | |||||
127 | { | 127 | { | ||
128 | QImage cursorImage = m_backend->softwareCursor(); | 128 | QImage cursorImage = m_backend->softwareCursor(); | ||
129 | if (cursorImage.isNull()) { | 129 | if (cursorImage.isNull()) { | ||
130 | return; | 130 | return; | ||
131 | } | 131 | } | ||
132 | m_hasNewCursor = true; | 132 | m_hasNewCursor = true; | ||
133 | QImage *c = m_cursor[m_cursorIndex]->image(); | 133 | QImage *c = m_cursor[m_cursorIndex]->image(); | ||
134 | c->fill(Qt::transparent); | 134 | c->fill(Qt::transparent); | ||
135 | c->setDevicePixelRatio(m_scale); | ||||
graesslin: what if we get a scaled cursor image from a client? | |||||
graesslin: saw the other patch, now it makes sense | |||||
136 | | ||||
135 | QPainter p; | 137 | QPainter p; | ||
136 | p.begin(c); | 138 | p.begin(c); | ||
137 | if (m_orientation == Qt::InvertedLandscapeOrientation) { | 139 | if (m_orientation == Qt::InvertedLandscapeOrientation) { | ||
138 | QMatrix4x4 matrix; | 140 | QMatrix4x4 matrix; | ||
139 | matrix.translate(cursorImage.width() / 2.0, cursorImage.height() / 2.0); | 141 | matrix.translate(cursorImage.width() / 2.0, cursorImage.height() / 2.0); | ||
140 | matrix.rotate(180.0f, 0.0f, 0.0f, 1.0f); | 142 | matrix.rotate(180.0f, 0.0f, 0.0f, 1.0f); | ||
141 | matrix.translate(-cursorImage.width() / 2.0, -cursorImage.height() / 2.0); | 143 | matrix.translate(-cursorImage.width() / 2.0, -cursorImage.height() / 2.0); | ||
142 | p.setWorldTransform(matrix.toTransform()); | 144 | p.setWorldTransform(matrix.toTransform()); | ||
Show All 10 Lines | 154 | if (m_orientation == Qt::InvertedLandscapeOrientation) { | |||
153 | matrix.translate(pixelSize().width() /2.0, pixelSize().height() / 2.0); | 155 | matrix.translate(pixelSize().width() /2.0, pixelSize().height() / 2.0); | ||
154 | matrix.rotate(180.0f, 0.0f, 0.0f, 1.0f); | 156 | matrix.rotate(180.0f, 0.0f, 0.0f, 1.0f); | ||
155 | matrix.translate(-pixelSize().width() /2.0, -pixelSize().height() / 2.0); | 157 | matrix.translate(-pixelSize().width() /2.0, -pixelSize().height() / 2.0); | ||
156 | const auto cursorSize = m_backend->softwareCursor().size(); | 158 | const auto cursorSize = m_backend->softwareCursor().size(); | ||
157 | hotspotMatrix.translate(cursorSize.width()/2.0, cursorSize.height()/2.0); | 159 | hotspotMatrix.translate(cursorSize.width()/2.0, cursorSize.height()/2.0); | ||
158 | hotspotMatrix.rotate(180.0f, 0.0f, 0.0f, 1.0f); | 160 | hotspotMatrix.rotate(180.0f, 0.0f, 0.0f, 1.0f); | ||
159 | hotspotMatrix.translate(-cursorSize.width()/2.0, -cursorSize.height()/2.0); | 161 | hotspotMatrix.translate(-cursorSize.width()/2.0, -cursorSize.height()/2.0); | ||
160 | } | 162 | } | ||
163 | hotspotMatrix.scale(m_scale); | ||||
161 | matrix.scale(m_scale); | 164 | matrix.scale(m_scale); | ||
162 | matrix.translate(-m_globalPos.x(), -m_globalPos.y()); | 165 | matrix.translate(-m_globalPos.x(), -m_globalPos.y()); | ||
163 | const QPoint p = matrix.map(globalPos) - hotspotMatrix.map(m_backend->softwareCursorHotspot()); | 166 | const QPoint p = matrix.map(globalPos) - hotspotMatrix.map(m_backend->softwareCursorHotspot()); | ||
164 | drmModeMoveCursor(m_backend->fd(), m_crtc->id(), p.x(), p.y()); | 167 | drmModeMoveCursor(m_backend->fd(), m_crtc->id(), p.x(), p.y()); | ||
165 | } | 168 | } | ||
166 | 169 | | |||
167 | QSize DrmOutput::pixelSize() const | 170 | QSize DrmOutput::pixelSize() const | ||
168 | { | 171 | { | ||
▲ Show 20 Lines • Show All 1150 Lines • Show Last 20 Lines |
what if we get a scaled cursor image from a client?