FrameSvgItem: fix textureRect for tiled subitems to not shrink to 0

Summary:
The old logic results in broken rendering if the sample was bigger than the
area to render, due to normalized texture rect being 0 in the respective
dimansion. As well as stretched mapping of the sample for fractional
relationships between the area to render and the sample size.

Test Plan:
Borders of backgrounds of FluffyBunny theme render properly, no other
regressions seen (but unsure what else might rely on that artifact).

Reviewers: #plasma, mart

Reviewed By: #plasma, mart

Subscribers: apol, sitter, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D19787
This commit is contained in:
Friedrich W. H. Kossebau 2019-03-15 15:24:52 +01:00
parent 3aba8a7e10
commit 0ffe183d71

View File

@ -145,11 +145,13 @@ public:
//if tiling horizontally
if (m_border == FrameSvg::TopBorder || m_border == FrameSvg::BottomBorder || m_border == FrameSvg::NoBorder) {
textureRect.setWidth(nodeRect.width() / m_elementNativeSize.width());
// cmp. CSS3's border-image-repeat: "repeat", though with first tile not centered, but aligned to left
textureRect.setWidth((qreal) nodeRect.width() / m_elementNativeSize.width());
}
//if tiling vertically
if (m_border == FrameSvg::LeftBorder || m_border == FrameSvg::RightBorder || m_border == FrameSvg::NoBorder) {
textureRect.setHeight(nodeRect.height() / m_elementNativeSize.height());
// cmp. CSS3's border-image-repeat: "repeat", though with first tile not centered, but aligned to top
textureRect.setHeight((qreal) nodeRect.height() / m_elementNativeSize.height());
}
} else if (m_fitMode == Stretch) {
QString prefix = m_frameSvg->frameSvg()->actualPrefix();