Create large enough atlas texture for decorations

When we render individual component of a decoration into an atlas we
ceil the positions for the individual component parts so they don't risk
overlapping. See SceneOpenGLDecorationRenderer::render

This isn't done when we set the overall texture height. This can cause
the bottommost part of the atlas (the right edge) to go out of view.

BUG: 453745
This commit is contained in:
David Edmundson 2022-07-08 12:34:22 +00:00 committed by Vlad Zahorodnii
parent 06db7fc7ff
commit c49620658f
2 changed files with 10 additions and 5 deletions

View file

@ -861,7 +861,7 @@ void SceneOpenGLDecorationRenderer::renderPart(const QRect &rect, const QRect &p
int verticalPadding = padding.top() + padding.bottom();
int horizontalPadding = padding.left() + padding.right();
QSize imageSize = rect.size() * devicePixelRatio;
QSize imageSize(toNativeSize(rect.width()), toNativeSize(rect.height()));
if (rotated) {
imageSize = QSize(imageSize.height(), imageSize.width());
}
@ -931,10 +931,9 @@ void SceneOpenGLDecorationRenderer::resizeTexture()
client()->window()->layoutDecorationRects(left, top, right, bottom);
QSize size;
size.rwidth() = qMax(qMax(top.width(), bottom.width()),
qMax(left.height(), right.height()));
size.rheight() = top.height() + bottom.height() + left.width() + right.width();
size *= effectiveDevicePixelRatio();
size.rwidth() = toNativeSize(qMax(qMax(top.width(), bottom.width()),
qMax(left.height(), right.height())));
size.rheight() = toNativeSize(top.height()) + toNativeSize(bottom.height()) + toNativeSize(left.width()) + toNativeSize(right.width());
size.rheight() += 4 * (2 * TexturePad);
size.rwidth() += 2 * TexturePad;
@ -954,4 +953,9 @@ void SceneOpenGLDecorationRenderer::resizeTexture()
}
}
int SceneOpenGLDecorationRenderer::toNativeSize(int size) const
{
return std::ceil(size * effectiveDevicePixelRatio());
}
} // namespace

View file

@ -146,6 +146,7 @@ private:
void renderPart(const QRect &rect, const QRect &partRect, const QPoint &textureOffset, qreal devicePixelRatio, bool rotated = false);
static const QMargins texturePadForPart(const QRect &rect, const QRect &partRect);
void resizeTexture();
int toNativeSize(int size) const;
QScopedPointer<GLTexture> m_texture;
};