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
icc-effect-5.14.5
David Edmundson 2016-11-23 16:19:13 +00:00
parent ebebc6ca82
commit 61bb907bb4
1 changed files with 6 additions and 1 deletions

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();
}