There are several spaces that have to be considered in GLRenderTarget::blitFromFramebuffer:
- KWin logical space: the origin is located at the global top-left corner
- display space: the origin is located at the top-left corner of monitor/display
- OpenGL screen space: the origin is located at the bottom-left corner of monitor/display
Given s, which is in the KWin logical space, we have to transform it to the display space, then to the OpenGL screen space:
- KWin logical space -> display space: y' = s.y() - s_virtualScreenGeometry.y()
- display space -> OpenGL screen space: y'' = s_virtualScreenGeometry.height() - y'
Overall, srcY0 and srcY1 should be written as follows:
srcY0 = s_virtualScreenGeometry.height() - (s.y() - s_virtualScreenGeometry.y() + s.height()) srcY1 = s_virtualScreenGeometry.height() - (s.y() - s_virtualScreenGeometry.y())