Bug 312851

Summary: Windows wider/taller than screen are cut off/partially mirrored when doing a screenshot of them using ksnapshot
Product: [Plasma] kwin Reporter: Elias Probst <mail>
Component: effects-variousAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal Flags: mgraesslin: ReviewRequest+
Priority: NOR    
Version: 4.9.97 (RC 2)   
Target Milestone: 4.11   
Platform: Gentoo Packages   
OS: Linux   
URL: https://git.reviewboard.kde.org/r/108258/
Latest Commit: Version Fixed In: 4.11
Sentry Crash Report:
Attachments: Screenshot showing window which exceeds the vertical resolution
Screenshot showing window which exceeds the horizontal resolution

Description Elias Probst 2013-01-08 00:57:01 UTC
Created attachment 76297 [details]
Screenshot showing window which exceeds the vertical resolution

When creating a screenshot of a window wider/taller than the screen's resolution, the part of the window which is beyond the screen's edge is:

# horizontal
- rendered completely transparent, even the shadow is cut off once the screen's edge is reached

# vertical
- only a gray background is rendered
- on the bottom of the window the windeco is rendered again, but mirrored

See the attached screenshots for examples.
Comment 1 Elias Probst 2013-01-08 00:58:02 UTC
Created attachment 76298 [details]
Screenshot showing window which exceeds the horizontal resolution

Please note, that the screenshot file isn't cut off at the right screen edge, but is actually just transparent.
Comment 2 Martin Flöser 2013-01-08 06:37:48 UTC
please add output of qdbus org.kde.kwin /KWin supportInformation
Comment 3 Thomas Lübking 2013-01-08 07:14:36 UTC
Happens here as well
nvidia; gl1 / 2 only; not xrender; not blur/zoom issue; not texture limit; shotting across two displays (one scene) works flawless.

it's likely clipped against the screen size/scene when rendered.
Comment 4 Martin Flöser 2013-01-08 07:32:06 UTC
My guess is that it is somewhere in the FBO usage. The texture size is correct - that I just tested. But it could still be viewport.

What might help: how is the window looking like in Present Windows with Lanczos filter enabled? Is it also showing the problem or is it correct there? I hope it's correct as that would make fixing very simple.
Comment 5 Thomas Lübking 2013-01-08 07:39:55 UTC
(In reply to comment #4)
> What might help: how is the window looking like in Present Windows with
> Lanczos filter enabled?

As expected. (with an absur ratio, but uncut)
Comment 6 Martin Flöser 2013-01-08 07:42:04 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > What might help: how is the window looking like in Present Windows with
> > Lanczos filter enabled?
> 
> As expected. (with an absur ratio, but uncut)
good, I'll do a line by line comparison of the FBO related code
Comment 7 Martin Flöser 2013-01-08 09:12:02 UTC
(In reply to comment #4)
> My guess is that it is somewhere in the FBO usage. The texture size is
> correct - that I just tested. But it could still be viewport.
I don't know what I read in the code, but it is obviously *wrong*. The texture size is created from displayWidth()/displayHeight(), so that just cannot work.

working on it
Comment 8 Martin Flöser 2013-01-08 09:52:24 UTC
@Elias: if possible please give the patch a try.
Comment 9 Elias Probst 2013-01-08 12:28:51 UTC
The patch provided on reviewboard fixes the issue for me. Thanks for even fixing such non-critical issues that fast! :)
Comment 10 Martin Flöser 2013-01-15 14:05:52 UTC
Git commit e15aaaef060ee823d143831766961fc3589cb65c by Martin Gräßlin.
Committed on 08/01/2013 at 10:46.
Pushed by graesslin into branch 'master'.

Use window size for offscreen texture size in screenshot effect

Effect used the display size which caused windows being larger than
either width or height not to be captured correctly.

Now it uses the window size for the offscreen texture which also requires
to adjust the modelviewprojection matrix.

As an unrelated change the pointer to GLRenderTarget and GLTexture are
changed to a QScopedPointer and some variables which got moved around
are consted.
FIXED-IN: 4.11
REVIEW: 108258

M  +87   -43   kwin/effects/screenshot/screenshot.cpp
M  +2    -0    kwin/effects/screenshot/screenshot.h

http://commits.kde.org/kde-workspace/e15aaaef060ee823d143831766961fc3589cb65c