D25427: [WIP][Wayland] Allow to take full resolution screenshot when scaling is used

David Edmundson noreply at phabricator.kde.org
Wed Nov 20 19:55:33 GMT 2019


davidedmundson added a comment.


  > On has a scaling of two and the other not. Would then one side of the image be double the size than the other one because we want the full resolution? Or would you scale the lower resolution half of the image up?
  
  I think it has to be uniform.

INLINE COMMENTS

> screenshot.cpp:620
> +            // tried QGuiApplication::primaryScreen()
> +            // and GLRenderTarget::virtualScreenScale()
> +            scale = 2;

Good question.

Use of Qt methods is slightly weird, as kwin implements it's own QPA which means we're reading things via an abstraction layer rather than directly. In theory it should work, but you're going to struggle to tie a QScreen to what's being rendered.

Ideally we would want to use KWin::Screens() but that's not exposed to effects.

GLRenderTarget::virtualScreenScale() is currently only set to screen->scale during the paint method. This is postPaint. We could set it during pre/postPaint too.

> screenshot.cpp:627
>              GLRenderTarget target(tex);
> -            target.blitFromFramebuffer(geometry);
> +            const auto scaledGeometry = QRect(static_cast<int>(geometry.x() * scale),
> +                                             static_cast<int>(geometry.y() * scale),

Avoid the term scaled in any variable name.

It can mean scaled from logical to device, or scaled from device to logical. Which means it fails to convey the one piece of important information you're trying to say.

use something like"deviceGeometry"

REPOSITORY
  R108 KWin

REVISION DETAIL
  https://phabricator.kde.org/D25427

To: meven, davidedmundson
Cc: davidre, kwin, LeGast00n, The-Feren-OS-Dev, sbergeron, jraleigh, fbampaloukas, GB_2, mkulinski, ragreen, jackyalcine, iodelay, crozbo, bwowk, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, hardening, romangg, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwin/attachments/20191120/99e96562/attachment.html>


More information about the kwin mailing list