Changeset View
Changeset View
Standalone View
Standalone View
pointer_input.cpp
Show First 20 Lines • Show All 1223 Lines • ▼ Show 20 Line(s) | 1223 | if (needsEmit) { | |||
---|---|---|---|---|---|
1224 | emit changed(); | 1224 | emit changed(); | ||
1225 | } | 1225 | } | ||
1226 | return; | 1226 | return; | ||
1227 | } | 1227 | } | ||
1228 | m_drag.cursor.hotspot = c->hotspot(); | 1228 | m_drag.cursor.hotspot = c->hotspot(); | ||
1229 | 1229 | | |||
1230 | if (additionalIcon.isNull()) { | 1230 | if (additionalIcon.isNull()) { | ||
1231 | m_drag.cursor.image = buffer->data().copy(); | 1231 | m_drag.cursor.image = buffer->data().copy(); | ||
1232 | m_drag.cursor.image.setDevicePixelRatio(cursorSurface->scale()); | ||||
1232 | } else { | 1233 | } else { | ||
1233 | QRect cursorRect = buffer->data().rect(); | 1234 | QRect cursorRect = buffer->data().rect(); | ||
1234 | QRect iconRect = additionalIcon.rect(); | 1235 | QRect iconRect = additionalIcon.rect(); | ||
1235 | 1236 | | |||
1236 | if (-m_drag.cursor.hotspot.x() < additionalIcon.offset().x()) { | 1237 | if (-m_drag.cursor.hotspot.x() < additionalIcon.offset().x()) { | ||
1237 | iconRect.moveLeft(m_drag.cursor.hotspot.x() - additionalIcon.offset().x()); | 1238 | iconRect.moveLeft(m_drag.cursor.hotspot.x() - additionalIcon.offset().x()); | ||
1238 | } else { | 1239 | } else { | ||
1239 | cursorRect.moveLeft(-additionalIcon.offset().x() - m_drag.cursor.hotspot.x()); | 1240 | cursorRect.moveLeft(-additionalIcon.offset().x() - m_drag.cursor.hotspot.x()); | ||
1240 | } | 1241 | } | ||
1241 | if (-m_drag.cursor.hotspot.y() < additionalIcon.offset().y()) { | 1242 | if (-m_drag.cursor.hotspot.y() < additionalIcon.offset().y()) { | ||
1242 | iconRect.moveTop(m_drag.cursor.hotspot.y() - additionalIcon.offset().y()); | 1243 | iconRect.moveTop(m_drag.cursor.hotspot.y() - additionalIcon.offset().y()); | ||
1243 | } else { | 1244 | } else { | ||
1244 | cursorRect.moveTop(-additionalIcon.offset().y() - m_drag.cursor.hotspot.y()); | 1245 | cursorRect.moveTop(-additionalIcon.offset().y() - m_drag.cursor.hotspot.y()); | ||
1245 | } | 1246 | } | ||
1246 | 1247 | | |||
1247 | m_drag.cursor.image = QImage(cursorRect.united(iconRect).size(), QImage::Format_ARGB32_Premultiplied); | 1248 | m_drag.cursor.image = QImage(cursorRect.united(iconRect).size(), QImage::Format_ARGB32_Premultiplied); | ||
1249 | m_drag.cursor.image.setDevicePixelRatio(cursorSurface->scale()); | ||||
1248 | m_drag.cursor.image.fill(Qt::transparent); | 1250 | m_drag.cursor.image.fill(Qt::transparent); | ||
1249 | QPainter p(&m_drag.cursor.image); | 1251 | QPainter p(&m_drag.cursor.image); | ||
1250 | p.drawImage(iconRect, additionalIcon); | 1252 | p.drawImage(iconRect, additionalIcon); | ||
1251 | p.drawImage(cursorRect, buffer->data()); | 1253 | p.drawImage(cursorRect, buffer->data()); | ||
1252 | p.end(); | 1254 | p.end(); | ||
1253 | } | 1255 | } | ||
1254 | 1256 | | |||
1255 | if (needsEmit) { | 1257 | if (needsEmit) { | ||
▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines |