diff options
Diffstat (limited to 'src/quick/scenegraph/coreapi/qsgmaterial.cpp')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgmaterial.cpp | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp index 0e40a01311..c0794d0d69 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp +++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp @@ -44,6 +44,10 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_DEBUG +static bool qsg_leak_check = !qgetenv("QML_LEAK_CHECK").isEmpty(); +#endif + /*! \group qtquick-scenegraph-materials \title Qt Quick Scene Graph Material Classes @@ -412,6 +416,12 @@ QMatrix4x4 QSGMaterialShader::RenderState::combinedMatrix() const return static_cast<const QSGRenderer *>(m_data)->currentCombinedMatrix(); } +float QSGMaterialShader::RenderState::devicePixelRatio() const +{ + Q_ASSERT(m_data); + return static_cast<const QSGRenderer *>(m_data)->devicePixelRatio(); +} + /*! @@ -438,6 +448,16 @@ QMatrix4x4 QSGMaterialShader::RenderState::modelViewMatrix() const return static_cast<const QSGRenderer *>(m_data)->currentModelViewMatrix(); } +/*! + Returns the projection matrix. + */ + +QMatrix4x4 QSGMaterialShader::RenderState::projectionMatrix() const +{ + Q_ASSERT(m_data); + return static_cast<const QSGRenderer *>(m_data)->currentProjectionMatrix(); +} + /*! @@ -538,11 +558,13 @@ QSGMaterial::QSGMaterial() : m_flags(0) { #ifndef QT_NO_DEBUG - ++qt_material_count; - static bool atexit_registered = false; - if (!atexit_registered) { - atexit(qt_print_material_count); - atexit_registered = true; + if (qsg_leak_check) { + ++qt_material_count; + static bool atexit_registered = false; + if (!atexit_registered) { + atexit(qt_print_material_count); + atexit_registered = true; + } } #endif } @@ -555,9 +577,11 @@ QSGMaterial::QSGMaterial() QSGMaterial::~QSGMaterial() { #ifndef QT_NO_DEBUG - --qt_material_count; - if (qt_material_count < 0) - qDebug("Material destroyed after qt_print_material_count() was called."); + if (qsg_leak_check) { + --qt_material_count; + if (qt_material_count < 0) + qDebug("Material destroyed after qt_print_material_count() was called."); + } #endif } |