From f25034afaf67c32057797ae790505e57a92deffc Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Fri, 17 Jul 2015 11:37:02 +0200 Subject: Fix video nodes material comparison. Don't consider a material equal to another when their texture IDs are not available yet. Change-Id: Id4127d71abb2db33950a206dc722b24ab626e960 Task-number: QTBUG-47205 Reviewed-by: Gunnar Sletta --- src/qtmultimediaquicktools/qsgvideonode_rgb.cpp | 4 ++++ src/qtmultimediaquicktools/qsgvideonode_texture.cpp | 4 ++++ src/qtmultimediaquicktools/qsgvideonode_yuv.cpp | 3 +++ 3 files changed, 11 insertions(+) (limited to 'src/qtmultimediaquicktools') diff --git a/src/qtmultimediaquicktools/qsgvideonode_rgb.cpp b/src/qtmultimediaquicktools/qsgvideonode_rgb.cpp index 0f682d1e5..5093acb59 100644 --- a/src/qtmultimediaquicktools/qsgvideonode_rgb.cpp +++ b/src/qtmultimediaquicktools/qsgvideonode_rgb.cpp @@ -145,6 +145,10 @@ public: virtual int compare(const QSGMaterial *other) const { const QSGVideoMaterial_RGB *m = static_cast(other); + + if (!m_textureId) + return 1; + return m_textureId - m->m_textureId; } diff --git a/src/qtmultimediaquicktools/qsgvideonode_texture.cpp b/src/qtmultimediaquicktools/qsgvideonode_texture.cpp index fd8d8719c..500c1c62f 100644 --- a/src/qtmultimediaquicktools/qsgvideonode_texture.cpp +++ b/src/qtmultimediaquicktools/qsgvideonode_texture.cpp @@ -138,6 +138,10 @@ public: virtual int compare(const QSGMaterial *other) const { const QSGVideoMaterial_Texture *m = static_cast(other); + + if (!m_textureId) + return 1; + int diff = m_textureId - m->m_textureId; if (diff) return diff; diff --git a/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp b/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp index c920ba3b9..af1e98cdf 100644 --- a/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp +++ b/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp @@ -171,6 +171,9 @@ public: virtual int compare(const QSGMaterial *other) const { const QSGVideoMaterial_YUV *m = static_cast(other); + if (!m_textureIds[0]) + return 1; + int d = m_textureIds[0] - m->m_textureIds[0]; if (d) return d; -- cgit v1.2.3