Scale openGL sub surfaces

Test Plan: Opened a module in system settings that uses QtQuick, confirmed it's the right size

Reviewers: #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3503
This commit is contained in:
David Edmundson 2016-11-23 16:19:13 +00:00
parent ebebc6ca82
commit 61bb907bb4

View file

@ -1452,12 +1452,17 @@ static void renderSubSurface(GLShader *shader, const QMatrix4x4 &mvp, const QMat
QMatrix4x4 newWindowMatrix = windowMatrix;
newWindowMatrix.translate(pixmap->subSurface()->position().x(), pixmap->subSurface()->position().y());
qreal scale = 1.0;
if (pixmap->surface()) {
scale = pixmap->surface()->scale();
}
if (!pixmap->texture()->isNull()) {
// render this texture
shader->setUniform(GLShader::ModelViewProjectionMatrix, mvp * newWindowMatrix);
auto texture = pixmap->texture();
texture->bind();
texture->render(QRegion(), QRect(0, 0, texture->width(), texture->height()));
texture->render(QRegion(), QRect(0, 0, texture->width() / scale, texture->height() / scale));
texture->unbind();
}