From 69c9f1997371a790b906218608ce280c460df315 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 15 Nov 2022 16:53:20 +0100 Subject: [PATCH] screencast: Don't scale the cursor Otherwise it gets cutt off when scaling > 1. This fixes Nate's screencasts (and anyone who has a system like nate's, that is). Part-of: --- src/plugins/screencast/screencaststream.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/screencast/screencaststream.cpp b/src/plugins/screencast/screencaststream.cpp index 52a6b3b7de..6f76f3713e 100644 --- a/src/plugins/screencast/screencaststream.cpp +++ b/src/plugins/screencast/screencaststream.cpp @@ -712,13 +712,15 @@ void ScreenCastStream::sendCursorData(Cursor *cursor, spa_meta_cursor *spa_meta_ m_cursor.lastKey = image.cacheKey(); spa_meta_cursor->bitmap_offset = sizeof(struct spa_meta_cursor); + const QSize targetSize = cursor->rect().size() * m_cursor.scale; + struct spa_meta_bitmap *spa_meta_bitmap = SPA_MEMBER(spa_meta_cursor, spa_meta_cursor->bitmap_offset, struct spa_meta_bitmap); spa_meta_bitmap->format = SPA_VIDEO_FORMAT_RGBA; spa_meta_bitmap->offset = sizeof(struct spa_meta_bitmap); - spa_meta_bitmap->size.width = std::min(m_cursor.bitmapSize.width(), image.width()); - spa_meta_bitmap->size.height = std::min(m_cursor.bitmapSize.height(), image.height()); + spa_meta_bitmap->size.width = std::min(m_cursor.bitmapSize.width(), targetSize.width()); + spa_meta_bitmap->size.height = std::min(m_cursor.bitmapSize.height(), targetSize.height()); spa_meta_bitmap->stride = spa_meta_bitmap->size.width * 4; uint8_t *bitmap_data = SPA_MEMBER(spa_meta_bitmap, spa_meta_bitmap->offset, uint8_t); @@ -727,12 +729,11 @@ void ScreenCastStream::sendCursorData(Cursor *cursor, spa_meta_cursor *spa_meta_ spa_meta_bitmap->size.height, spa_meta_bitmap->stride, QImage::Format_RGBA8888_Premultiplied); - dest.setDevicePixelRatio(m_cursor.scale); dest.fill(Qt::transparent); if (!image.isNull()) { QPainter painter(&dest); - painter.drawImage(QPoint(), image); + painter.drawImage(QRect({0, 0}, targetSize), image); } }