-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5.3
-
None
but the layer can have mirroring disabled...
The problem appears in such a case:
- QT_QUICK_BACKEND=software is used;
- Сustom effect implemented:
// qml file Item { ... layer.enabled: true layer.textureMirroring: ShaderEffectSource.NoMirroring layer.effect: CustomEffect {} ... } // custom effect cpp source QSGNode *CustomEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { ... // QQuickShaderEffectSource *m_source auto provider = m_source->textureProvider(); auto texture = qobject_cast<QSGLayer *>(provider->texture()); auto node = static_cast<QSGInternalImageNode *>(oldNode); if (!node) { auto renderContext = QQuickItemPrivate::get(this)->sceneGraphRenderContext(); node = context->createInternalImageNode(renderContext); node->setFlag(QSGNode::UsePreprocess); node->setTexture(texture); ... } ... }
The resulting effect is mirrored.
I think QSGSoftwareInternalImageNode::update is missing a check for mirroring when setting the transform :
void QSGSoftwareInternalImageNode::update()
{
if (m_cachedMirroredPixmapIsDirty) {
if (m_mirrorHorizontally || m_mirrorVertically || m_textureIsLayer) {
QTransform transform((m_mirrorHorizontally ? -1 : 1), 0, 0,
(m_textureIsLayer ? -1 : 1) * (m_mirrorVertically ? -1 : 1), 0, 0);
m_cachedMirroredPixmap = pixmap().transformed(transform);
} else {
// Cleanup cached pixmap if necessary
if (!m_cachedMirroredPixmap.isNull())
m_cachedMirroredPixmap = QPixmap();
}
m_cachedMirroredPixmapIsDirty = false;
}
}
Everything works correctly if layer mirroring is checked, for example like this:
if (m_mirrorHorizontally || m_mirrorVertically || (m_textureIsLayer && m_textureIsMirrored)) {
...