Remove displayWidth and displayHeight from the compositor
Instead of getting size from displayWidth() and displayHeight() use the information we have from Screens. This means there is only one place to have the information and by that we can ensure that all components use the same data to rely on. displayWidth/displayHeight seem to provide the wrong information when unplugging an output without disabling the output. This results in rendering artefacts. But KWin::Screens has the correct information available.icc-effect-5.14.5
parent
cc98c5d9c7
commit
bf4ba54647
|
@ -32,6 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "scene_xrender.h"
|
||||
#include "scene_opengl.h"
|
||||
#include "scene_qpainter.h"
|
||||
#include "screens.h"
|
||||
#include "shadow.h"
|
||||
#include "useractions.h"
|
||||
#include "compositingprefs.h"
|
||||
|
@ -548,7 +549,8 @@ void Compositor::addRepaintFull()
|
|||
{
|
||||
if (!hasScene())
|
||||
return;
|
||||
repaints_region = QRegion(0, 0, displayWidth(), displayHeight());
|
||||
const QSize &s = screens()->size();
|
||||
repaints_region = QRegion(0, 0, s.width(), s.height());
|
||||
scheduleRepaint();
|
||||
}
|
||||
|
||||
|
@ -785,7 +787,8 @@ void Compositor::delayedCheckUnredirect()
|
|||
forceUnredirectCheck = false;
|
||||
// Cut out parts from the overlay window where unredirected windows are,
|
||||
// so that they are actually visible.
|
||||
QRegion reg(0, 0, displayWidth(), displayHeight());
|
||||
const QSize &s = screens()->size();
|
||||
QRegion reg(0, 0, s.width(), s.height());
|
||||
foreach (Toplevel * c, list) {
|
||||
if (c->unredirected())
|
||||
reg -= c->geometry();
|
||||
|
|
|
@ -679,7 +679,8 @@ void EffectsHandlerImpl::startMouseInterception(Effect *effect, Qt::CursorShape
|
|||
// NOTE: it is intended to not perform an XPointerGrab on X11. See documentation in kwineffects.h
|
||||
// The mouse grab is implemented by using a full screen input only window
|
||||
if (!m_mouseInterceptionWindow.isValid()) {
|
||||
const QRect geo(0, 0, displayWidth(), displayHeight());
|
||||
const QSize &s = screens()->size();
|
||||
const QRect geo(0, 0, s.width(), s.height());
|
||||
const uint32_t mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK | XCB_CW_CURSOR;
|
||||
const uint32_t values[] = {
|
||||
true,
|
||||
|
|
|
@ -368,7 +368,7 @@ void ContrastEffect::doContrast(const QRegion& shape, const QRect& screen, const
|
|||
scratch.setWrapMode(GL_CLAMP_TO_EDGE);
|
||||
scratch.bind();
|
||||
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r.x(), displayHeight() - r.y() - r.height(),
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r.x(), effects->virtualScreenSize().height() - r.y() - r.height(),
|
||||
r.width(), r.height());
|
||||
|
||||
// Draw the texture on the offscreen framebuffer object, while blurring it horizontally
|
||||
|
|
|
@ -443,7 +443,7 @@ void BlurEffect::doBlur(const QRegion& shape, const QRect& screen, const float o
|
|||
scratch.setWrapMode(GL_CLAMP_TO_EDGE);
|
||||
scratch.bind();
|
||||
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r.x(), displayHeight() - r.y() - r.height(),
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r.x(), effects->virtualScreenSize().height() - r.y() - r.height(),
|
||||
r.width(), r.height());
|
||||
|
||||
// Draw the texture on the offscreen framebuffer object, while blurring it horizontally
|
||||
|
@ -587,7 +587,7 @@ void BlurEffect::doCachedBlur(EffectWindow *w, const QRegion& region, const floa
|
|||
// into a scratch texture (in this case "tex").
|
||||
tex.bind();
|
||||
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, updateRect.x(), displayHeight() - updateRect.y() - updateRect.height(),
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, updateRect.x(), effects->virtualScreenSize().height() - updateRect.y() - updateRect.height(),
|
||||
updateRect.width(), updateRect.height());
|
||||
|
||||
// Draw the texture on the offscreen framebuffer object, while blurring it horizontally
|
||||
|
|
|
@ -314,7 +314,7 @@ void LogoutEffect::renderVignetting()
|
|||
const QRect fullArea = effects->clientArea(FullArea, 0, 0);
|
||||
for (int screen = 0; screen < effects->numScreens(); screen++) {
|
||||
const QRect screenGeom = effects->clientArea(ScreenArea, screen, 0);
|
||||
glScissor(screenGeom.x(), displayHeight() - screenGeom.y() - screenGeom.height(),
|
||||
glScissor(screenGeom.x(), effects->virtualScreenSize().height() - screenGeom.y() - screenGeom.height(),
|
||||
screenGeom.width(), screenGeom.height()); // GL coords are flipped
|
||||
const float cenX = screenGeom.x() + screenGeom.width() / 2;
|
||||
const float cenY = fullArea.height() - screenGeom.y() - screenGeom.height() / 2;
|
||||
|
|
|
@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "utils.h"
|
||||
#include "overlaywindow.h"
|
||||
#include "composite.h"
|
||||
#include "screens.h"
|
||||
#include "xcbutils.h"
|
||||
// kwin libs
|
||||
#include <kwinglplatform.h>
|
||||
|
@ -324,7 +325,8 @@ bool GlxBackend::initBuffer()
|
|||
}
|
||||
XSetWindowAttributes attrs;
|
||||
attrs.colormap = XCreateColormap(display(), rootWindow(), visual->visual, AllocNone);
|
||||
window = XCreateWindow(display(), overlayWindow()->window(), 0, 0, displayWidth(), displayHeight(),
|
||||
const QSize &screenSize = screens()->size();
|
||||
window = XCreateWindow(display(), overlayWindow()->window(), 0, 0, screenSize.width(), screenSize.height(),
|
||||
0, visual->depth, InputOutput, visual->visual, CWColormap, &attrs);
|
||||
glxWindow = glXCreateWindow(display(), fbconfig, window, NULL);
|
||||
overlayWindow()->setup(window);
|
||||
|
@ -539,7 +541,8 @@ void GlxBackend::present()
|
|||
if (lastDamage().isEmpty())
|
||||
return;
|
||||
|
||||
const QRegion displayRegion(0, 0, displayWidth(), displayHeight());
|
||||
const QSize &screenSize = screens()->size();
|
||||
const QRegion displayRegion(0, 0, screenSize.width(), screenSize.height());
|
||||
const bool fullRepaint = supportsBufferAge() || (lastDamage() == displayRegion);
|
||||
|
||||
if (fullRepaint) {
|
||||
|
@ -581,7 +584,7 @@ void GlxBackend::present()
|
|||
} else if (m_haveMESACopySubBuffer) {
|
||||
foreach (const QRect & r, lastDamage().rects()) {
|
||||
// convert to OpenGL coordinates
|
||||
int y = displayHeight() - r.y() - r.height();
|
||||
int y = screenSize.height() - r.y() - r.height();
|
||||
glXCopySubBufferMESA(display(), glxWindow, r.x(), y, r.width(), r.height());
|
||||
}
|
||||
} else { // Copy Pixels (horribly slow on Mesa)
|
||||
|
|
|
@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "client.h"
|
||||
#include "deleted.h"
|
||||
#include "effects.h"
|
||||
#include "screens.h"
|
||||
#include "unmanaged.h"
|
||||
#include "options.h"
|
||||
#include "workspace.h"
|
||||
|
@ -101,8 +102,9 @@ void LanczosFilter::init()
|
|||
|
||||
void LanczosFilter::updateOffscreenSurfaces()
|
||||
{
|
||||
int w = displayWidth();
|
||||
int h = displayHeight();
|
||||
const QSize &s = screens()->size();
|
||||
int w = s.width();
|
||||
int h = s.height();
|
||||
|
||||
if (!m_offscreenTex || m_offscreenTex->width() != w || m_offscreenTex->height() != h) {
|
||||
if (m_offscreenTex) {
|
||||
|
|
|
@ -213,8 +213,9 @@ quint64 AnimationEffect::p_animate( EffectWindow *w, Attribute a, uint meta, int
|
|||
|
||||
if (delay > 0) {
|
||||
QTimer::singleShot(delay, this, SLOT(triggerRepaint()));
|
||||
const QSize &s = effects->virtualScreenSize();
|
||||
if (waitAtSource)
|
||||
w->addLayerRepaint(0, 0, displayWidth(), displayHeight());
|
||||
w->addLayerRepaint(0, 0, s.width(), s.height());
|
||||
}
|
||||
else {
|
||||
triggerRepaint();
|
||||
|
@ -751,7 +752,7 @@ void AnimationEffect::updateLayerRepaints()
|
|||
break;
|
||||
case Rotation:
|
||||
createRegion = false;
|
||||
*layerRect = QRect(0, 0, displayWidth(), displayHeight());
|
||||
*layerRect = QRect(QPoint(0, 0), effects->virtualScreenSize());
|
||||
goto region_creation; // sic! no need to do anything else
|
||||
case Generic:
|
||||
d->m_needSceneRepaint = true; // we don't know whether this will change visual stacking order
|
||||
|
|
|
@ -1370,7 +1370,8 @@ bool PaintClipper::clip()
|
|||
QRegion PaintClipper::paintArea()
|
||||
{
|
||||
assert(areas != nullptr); // can be called only with clip() == true
|
||||
QRegion ret = QRegion(0, 0, displayWidth(), displayHeight());
|
||||
const QSize &s = effects->virtualScreenSize();
|
||||
QRegion ret = QRegion(0, 0, s.width(), s.height());
|
||||
foreach (const QRegion & r, *areas)
|
||||
ret &= r;
|
||||
return ret;
|
||||
|
|
|
@ -615,6 +615,7 @@ QMatrix4x4 GLShader::getUniformMatrix4x4(const char* name)
|
|||
// ShaderManager
|
||||
//****************************************
|
||||
ShaderManager *ShaderManager::s_shaderManager = nullptr;
|
||||
QSize ShaderManager::s_virtualScreenSize;
|
||||
|
||||
ShaderManager *ShaderManager::instance()
|
||||
{
|
||||
|
@ -868,7 +869,7 @@ void ShaderManager::resetShader(ShaderType type)
|
|||
|
||||
switch(type) {
|
||||
case SimpleShader:
|
||||
projection.ortho(0, displayWidth(), displayHeight(), 0, 0, 65535);
|
||||
projection.ortho(0, s_virtualScreenSize.width(), s_virtualScreenSize.height(), 0, 0, 65535);
|
||||
break;
|
||||
|
||||
case GenericShader: {
|
||||
|
@ -886,12 +887,12 @@ void ShaderManager::resetShader(ShaderType type)
|
|||
// Set up the model-view matrix
|
||||
float scaleFactor = 1.1 * tan(fovy * M_PI / 360.0f) / ymax;
|
||||
modelView.translate(xmin * scaleFactor, ymax * scaleFactor, -1.1);
|
||||
modelView.scale((xmax - xmin)*scaleFactor / displayWidth(), -(ymax - ymin)*scaleFactor / displayHeight(), 0.001);
|
||||
modelView.scale((xmax - xmin)*scaleFactor / s_virtualScreenSize.width(), -(ymax - ymin)*scaleFactor / s_virtualScreenSize.height(), 0.001);
|
||||
break;
|
||||
}
|
||||
|
||||
case ColorShader:
|
||||
projection.ortho(0, displayWidth(), displayHeight(), 0, 0, 65535);
|
||||
projection.ortho(0, s_virtualScreenSize.width(), s_virtualScreenSize.height(), 0, 0, 65535);
|
||||
shader->setUniform("geometryColor", QVector4D(0, 0, 0, 1));
|
||||
break;
|
||||
}
|
||||
|
@ -913,6 +914,7 @@ void ShaderManager::resetShader(ShaderType type)
|
|||
bool GLRenderTarget::sSupported = false;
|
||||
bool GLRenderTarget::s_blitSupported = false;
|
||||
QStack<GLRenderTarget*> GLRenderTarget::s_renderTargets = QStack<GLRenderTarget*>();
|
||||
QSize GLRenderTarget::s_virtualScreenSize;
|
||||
|
||||
void GLRenderTarget::initStatic()
|
||||
{
|
||||
|
@ -961,7 +963,7 @@ GLRenderTarget* GLRenderTarget::popRenderTarget()
|
|||
if (!s_renderTargets.isEmpty()) {
|
||||
s_renderTargets.top()->enable();
|
||||
} else {
|
||||
glViewport (0, 0, displayWidth(), displayHeight());
|
||||
glViewport (0, 0, s_virtualScreenSize.width(), s_virtualScreenSize.height());
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -1118,10 +1120,10 @@ void GLRenderTarget::blitFromFramebuffer(const QRect &source, const QRect &desti
|
|||
GLRenderTarget::pushRenderTarget(this);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFramebuffer);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
const QRect s = source.isNull() ? QRect(0, 0, displayWidth(), displayHeight()) : source;
|
||||
const QRect s = source.isNull() ? QRect(0, 0, s_virtualScreenSize.width(), s_virtualScreenSize.height()) : source;
|
||||
const QRect d = destination.isNull() ? QRect(0, 0, mTexture.width(), mTexture.height()) : destination;
|
||||
|
||||
glBlitFramebuffer(s.x(), displayHeight() - s.y() - s.height(), s.x() + s.width(), displayHeight() - s.y(),
|
||||
glBlitFramebuffer(s.x(), s_virtualScreenSize.height() - s.y() - s.height(), s.x() + s.width(), s_virtualScreenSize.height() - s.y(),
|
||||
d.x(), mTexture.height() - d.y() - d.height(), d.x() + d.width(), mTexture.height() - d.y(),
|
||||
GL_COLOR_BUFFER_BIT, filter);
|
||||
GLRenderTarget::popRenderTarget();
|
||||
|
@ -1658,6 +1660,8 @@ GLvoid *GLVertexBufferPrivate::mapNextFreeRange(size_t size)
|
|||
//*********************************
|
||||
// GLVertexBuffer
|
||||
//*********************************
|
||||
QSize GLVertexBuffer::s_virtualScreenSize;
|
||||
|
||||
GLVertexBuffer::GLVertexBuffer(UsageHint hint)
|
||||
: d(new GLVertexBufferPrivate(hint))
|
||||
{
|
||||
|
@ -1820,7 +1824,7 @@ void GLVertexBuffer::draw(const QRegion ®ion, GLenum primitiveMode, int first
|
|||
} else {
|
||||
// Clip using scissoring
|
||||
foreach (const QRect &r, region.rects()) {
|
||||
glScissor(r.x(), displayHeight() - r.y() - r.height(), r.width(), r.height());
|
||||
glScissor(r.x(), s_virtualScreenSize.height() - r.y() - r.height(), r.width(), r.height());
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, nullptr, first);
|
||||
}
|
||||
}
|
||||
|
@ -1833,7 +1837,7 @@ void GLVertexBuffer::draw(const QRegion ®ion, GLenum primitiveMode, int first
|
|||
} else {
|
||||
// Clip using scissoring
|
||||
foreach (const QRect &r, region.rects()) {
|
||||
glScissor(r.x(), displayHeight() - r.y() - r.height(), r.width(), r.height());
|
||||
glScissor(r.x(), s_virtualScreenSize.height() - r.y() - r.height(), r.width(), r.height());
|
||||
glDrawArrays(primitiveMode, first, count);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -336,6 +336,14 @@ public:
|
|||
**/
|
||||
GLShader *loadShaderFromCode(const QByteArray &vertexSource, const QByteArray &fragmentSource);
|
||||
|
||||
/**
|
||||
* Sets the virtual screen size to @p s.
|
||||
* @since 5.2
|
||||
**/
|
||||
static void setVirtualScreenSize(const QSize &s) {
|
||||
s_virtualScreenSize = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a pointer to the ShaderManager instance
|
||||
**/
|
||||
|
@ -362,6 +370,7 @@ private:
|
|||
bool m_debug;
|
||||
QByteArray m_shaderDir;
|
||||
static ShaderManager *s_shaderManager;
|
||||
static QSize s_virtualScreenSize;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -505,6 +514,14 @@ public:
|
|||
**/
|
||||
void blitFromFramebuffer(const QRect &source = QRect(), const QRect &destination = QRect(), GLenum filter = GL_LINEAR);
|
||||
|
||||
/**
|
||||
* Sets the virtual screen size to @p s.
|
||||
* @since 5.2
|
||||
**/
|
||||
static void setVirtualScreenSize(const QSize &s) {
|
||||
s_virtualScreenSize = s;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
void initFBO();
|
||||
|
@ -516,6 +533,7 @@ private:
|
|||
static bool sSupported;
|
||||
static bool s_blitSupported;
|
||||
static QStack<GLRenderTarget*> s_renderTargets;
|
||||
static QSize s_virtualScreenSize;
|
||||
|
||||
GLTexture mTexture;
|
||||
bool mValid;
|
||||
|
@ -732,8 +750,17 @@ public:
|
|||
**/
|
||||
static GLVertexBuffer *streamingBuffer();
|
||||
|
||||
/**
|
||||
* Sets the virtual screen size to @p s.
|
||||
* @since 5.2
|
||||
**/
|
||||
static void setVirtualScreenSize(const QSize &s) {
|
||||
s_virtualScreenSize = s;
|
||||
}
|
||||
|
||||
private:
|
||||
GLVertexBufferPrivate* const d;
|
||||
static QSize s_virtualScreenSize;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "overlaywindow.h"
|
||||
|
||||
#include "kwinglobals.h"
|
||||
#include "screens.h"
|
||||
#include "utils.h"
|
||||
#include "xcbutils.h"
|
||||
|
||||
|
@ -61,7 +62,7 @@ bool OverlayWindow::create()
|
|||
m_window = overlay->overlay_win;
|
||||
if (m_window == XCB_WINDOW_NONE)
|
||||
return false;
|
||||
resize(QSize(displayWidth(), displayHeight()));
|
||||
resize(screens()->size());
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
|
@ -74,7 +75,8 @@ void OverlayWindow::setup(xcb_window_t window)
|
|||
assert(Xcb::Extensions::self()->isShapeInputAvailable());
|
||||
setNoneBackgroundPixmap(m_window);
|
||||
m_shape = QRegion();
|
||||
setShape(QRect(0, 0, displayWidth(), displayHeight()));
|
||||
const QSize &s = screens()->size();
|
||||
setShape(QRect(0, 0, s.width(), s.height()));
|
||||
if (window != XCB_WINDOW_NONE) {
|
||||
setNoneBackgroundPixmap(window);
|
||||
setupInputShape(window);
|
||||
|
@ -109,7 +111,8 @@ void OverlayWindow::hide()
|
|||
assert(m_window != XCB_WINDOW_NONE);
|
||||
xcb_unmap_window(connection(), m_window);
|
||||
m_shown = false;
|
||||
setShape(QRect(0, 0, displayWidth(), displayHeight()));
|
||||
const QSize &s = screens()->size();
|
||||
setShape(QRect(0, 0, s.width(), s.height()));
|
||||
}
|
||||
|
||||
void OverlayWindow::setShape(const QRegion& reg)
|
||||
|
@ -161,7 +164,8 @@ void OverlayWindow::destroy()
|
|||
if (m_window == XCB_WINDOW_NONE)
|
||||
return;
|
||||
// reset the overlay shape
|
||||
xcb_rectangle_t rec = { 0, 0, static_cast<uint16_t>(displayWidth()), static_cast<uint16_t>(displayHeight()) };
|
||||
const QSize &s = screens()->size();
|
||||
xcb_rectangle_t rec = { 0, 0, static_cast<uint16_t>(s.width()), static_cast<uint16_t>(s.height()) };
|
||||
xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, m_window, 0, 0, 1, &rec);
|
||||
xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, m_window, 0, 0, 1, &rec);
|
||||
#ifdef KWIN_HAVE_XCOMPOSITE_OVERLAY
|
||||
|
|
20
scene.cpp
20
scene.cpp
|
@ -76,6 +76,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "deleted.h"
|
||||
#include "effects.h"
|
||||
#include "overlaywindow.h"
|
||||
#include "screens.h"
|
||||
#include "shadow.h"
|
||||
|
||||
#include "thumbnailitem.h"
|
||||
|
@ -107,7 +108,8 @@ Scene::~Scene()
|
|||
void Scene::paintScreen(int* mask, const QRegion &damage, const QRegion &repaint,
|
||||
QRegion *updateRegion, QRegion *validRegion)
|
||||
{
|
||||
const QRegion displayRegion(0, 0, displayWidth(), displayHeight());
|
||||
const QSize &screenSize = screens()->size();
|
||||
const QRegion displayRegion(0, 0, screenSize.width(), screenSize.height());
|
||||
*mask = (damage == displayRegion) ? 0 : PAINT_SCREEN_REGION;
|
||||
|
||||
updateTimeDiff();
|
||||
|
@ -240,7 +242,8 @@ void Scene::paintGenericScreen(int orig_mask, ScreenPaintData)
|
|||
paintWindow(d.window, d.mask, d.region, d.quads);
|
||||
}
|
||||
|
||||
damaged_region = QRegion(0, 0, displayWidth(), displayHeight());
|
||||
const QSize &screenSize = screens()->size();
|
||||
damaged_region = QRegion(0, 0, screenSize.width(), screenSize.height());
|
||||
}
|
||||
|
||||
// The optimized case without any transformations at all.
|
||||
|
@ -323,7 +326,8 @@ void Scene::paintSimpleScreen(int orig_mask, QRegion region)
|
|||
const QRegion repaintClip = repaint_region - dirtyArea;
|
||||
dirtyArea |= repaint_region;
|
||||
|
||||
const QRegion displayRegion(0, 0, displayWidth(), displayHeight());
|
||||
const QSize &screenSize = screens()->size();
|
||||
const QRegion displayRegion(0, 0, screenSize.width(), screenSize.height());
|
||||
bool fullRepaint(dirtyArea == displayRegion); // spare some expensive region operations
|
||||
if (!fullRepaint) {
|
||||
extendPaintRegion(dirtyArea, opaqueFullscreen);
|
||||
|
@ -457,7 +461,8 @@ static Scene::Window *s_recursionCheck = NULL;
|
|||
void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quads)
|
||||
{
|
||||
// no painting outside visible screen (and no transformations)
|
||||
region &= QRect(0, 0, displayWidth(), displayHeight());
|
||||
const QSize &screenSize = screens()->size();
|
||||
region &= QRect(0, 0, screenSize.width(), screenSize.height());
|
||||
if (region.isEmpty()) // completely clipped
|
||||
return;
|
||||
if (w->window()->isDeleted() && w->window()->skipsCloseAnimation()) {
|
||||
|
@ -571,11 +576,12 @@ void Scene::paintDesktopThumbnails(Scene::Window *w)
|
|||
s_recursionCheck = w;
|
||||
|
||||
ScreenPaintData data;
|
||||
QSize size = QSize(displayWidth(), displayHeight());
|
||||
const QSize &screenSize = screens()->size();
|
||||
QSize size = screenSize;
|
||||
|
||||
size.scale(item->width(), item->height(), Qt::KeepAspectRatio);
|
||||
data *= QVector2D(size.width() / double(displayWidth()),
|
||||
size.height() / double(displayHeight()));
|
||||
data *= QVector2D(size.width() / double(screenSize.width()),
|
||||
size.height() / double(screenSize.height()));
|
||||
const QPointF point = item->mapToScene(item->position());
|
||||
const qreal x = point.x() + w->x() + (item->width() - size.width())/2;
|
||||
const qreal y = point.y() + w->y() + (item->height() - size.height()) / 2;
|
||||
|
|
|
@ -333,7 +333,8 @@ QRegion OpenGLBackend::accumulatedDamageHistory(int bufferAge) const
|
|||
for (int i = 0; i < bufferAge - 1; i++)
|
||||
region |= m_damageHistory[i];
|
||||
} else {
|
||||
region = QRegion(0, 0, displayWidth(), displayHeight());
|
||||
const QSize &s = screens()->size();
|
||||
region = QRegion(0, 0, s.width(), s.height());
|
||||
}
|
||||
|
||||
return region;
|
||||
|
@ -359,7 +360,7 @@ SceneOpenGL::SceneOpenGL(Workspace* ws, OpenGLBackend *backend)
|
|||
init_ok = false;
|
||||
return;
|
||||
}
|
||||
if (!viewportLimitsMatched(QSize(displayWidth(), displayHeight())))
|
||||
if (!viewportLimitsMatched(screens()->size()))
|
||||
return;
|
||||
|
||||
// perform Scene specific checks
|
||||
|
@ -554,11 +555,12 @@ bool SceneOpenGL::initFailed() const
|
|||
#ifndef KWIN_HAVE_OPENGLES
|
||||
void SceneOpenGL::copyPixels(const QRegion ®ion)
|
||||
{
|
||||
const int height = screens()->size().height();
|
||||
foreach (const QRect &r, region.rects()) {
|
||||
const int x0 = r.x();
|
||||
const int y0 = displayHeight() - r.y() - r.height();
|
||||
const int y0 = height - r.y() - r.height();
|
||||
const int x1 = r.x() + r.width();
|
||||
const int y1 = displayHeight() - r.y();
|
||||
const int y1 = height - r.y();
|
||||
|
||||
glBlitFramebuffer(x0, y0, x1, y1, x0, y0, x1, y1, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
}
|
||||
|
@ -648,7 +650,8 @@ qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
|
|||
paintScreen(&mask, damage, repaint, &updateRegion, &validRegion); // call generic implementation
|
||||
|
||||
#ifndef KWIN_HAVE_OPENGLES
|
||||
const QRegion displayRegion(0, 0, displayWidth(), displayHeight());
|
||||
const QSize &screenSize = screens()->size();
|
||||
const QRegion displayRegion(0, 0, screenSize.width(), screenSize.height());
|
||||
|
||||
// copy dirty parts from front to backbuffer
|
||||
if (!m_backend->supportsBufferAge() &&
|
||||
|
@ -729,10 +732,11 @@ void SceneOpenGL::extendPaintRegion(QRegion ®ion, bool opaqueFullscreen)
|
|||
if (m_backend->supportsBufferAge())
|
||||
return;
|
||||
|
||||
const QSize &screenSize = screens()->size();
|
||||
if (options->glPreferBufferSwap() == Options::ExtendDamage) { // only Extend "large" repaints
|
||||
const QRegion displayRegion(0, 0, displayWidth(), displayHeight());
|
||||
const QRegion displayRegion(0, 0, screenSize.width(), screenSize.height());
|
||||
uint damagedPixels = 0;
|
||||
const uint fullRepaintLimit = (opaqueFullscreen?0.49f:0.748f)*displayWidth()*displayHeight();
|
||||
const uint fullRepaintLimit = (opaqueFullscreen?0.49f:0.748f)*screenSize.width()*screenSize.height();
|
||||
// 16:9 is 75% of 4:3 and 2.55:1 is 49.01% of 5:4
|
||||
// (5:4 is the most square format and 2.55:1 is Cinemascope55 - the widest ever shot
|
||||
// movie aspect - two times ;-) It's a Fox format, though, so maybe we want to restrict
|
||||
|
@ -747,7 +751,7 @@ void SceneOpenGL::extendPaintRegion(QRegion ®ion, bool opaqueFullscreen)
|
|||
}
|
||||
}
|
||||
} else if (options->glPreferBufferSwap() == Options::PaintFullScreen) { // forced full rePaint
|
||||
region = QRegion(0, 0, displayWidth(), displayHeight());
|
||||
region = QRegion(0, 0, screenSize.width(), screenSize.height());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -828,6 +832,9 @@ void SceneOpenGL::screenGeometryChanged(const QSize &size)
|
|||
Scene::screenGeometryChanged(size);
|
||||
glViewport(0,0, size.width(), size.height());
|
||||
m_backend->screenGeometryChanged(size);
|
||||
ShaderManager::setVirtualScreenSize(size);
|
||||
GLRenderTarget::setVirtualScreenSize(size);
|
||||
GLVertexBuffer::setVirtualScreenSize(size);
|
||||
ShaderManager::instance()->resetAllShaders();
|
||||
}
|
||||
|
||||
|
@ -835,7 +842,7 @@ void SceneOpenGL::paintDesktop(int desktop, int mask, const QRegion ®ion, Scr
|
|||
{
|
||||
const QRect r = region.boundingRect();
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glScissor(r.x(), displayHeight() - r.y() - r.height(), r.width(), r.height());
|
||||
glScissor(r.x(), screens()->size().height() - r.y() - r.height(), r.width(), r.height());
|
||||
KWin::Scene::paintDesktop(desktop, mask, region, data);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
@ -900,6 +907,10 @@ SceneOpenGL2::SceneOpenGL2(OpenGLBackend *backend)
|
|||
slotColorCorrectedChanged(false);
|
||||
connect(options, SIGNAL(colorCorrectedChanged()), this, SLOT(slotColorCorrectedChanged()), Qt::QueuedConnection);
|
||||
|
||||
const QSize &s = screens()->size();
|
||||
ShaderManager::setVirtualScreenSize(s);
|
||||
GLRenderTarget::setVirtualScreenSize(s);
|
||||
GLVertexBuffer::setVirtualScreenSize(s);
|
||||
if (!ShaderManager::instance()->isValid()) {
|
||||
qDebug() << "No Scene Shaders available";
|
||||
init_ok = false;
|
||||
|
|
Loading…
Reference in New Issue