Commit c4962065 authored by David Edmundson's avatar David Edmundson Committed by Vlad Zahorodnii
Browse files

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
parent 06db7fc7
Pipeline #201419 passed with stage
in 16 minutes and 18 seconds
......@@ -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
......@@ -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;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment