diff options
Diffstat (limited to 'src/quick/scenegraph/util')
-rw-r--r-- | src/quick/scenegraph/util/qsgrhiatlastexture.cpp | 9 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgtexturematerial.cpp | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/quick/scenegraph/util/qsgrhiatlastexture.cpp b/src/quick/scenegraph/util/qsgrhiatlastexture.cpp index 2a7be48d3d..5541c4f2da 100644 --- a/src/quick/scenegraph/util/qsgrhiatlastexture.cpp +++ b/src/quick/scenegraph/util/qsgrhiatlastexture.cpp @@ -67,8 +67,13 @@ Manager::Manager(QSGDefaultRenderContext *rc, const QSize &surfacePixelSize, QSu , m_rhi(rc->rhi()) { const int maxSize = m_rhi->resourceLimit(QRhi::TextureSizeMax); - int w = qMin(maxSize, qt_sg_envInt("QSG_ATLAS_WIDTH", qMax(512U, qNextPowerOfTwo(surfacePixelSize.width() - 1)))); - int h = qMin(maxSize, qt_sg_envInt("QSG_ATLAS_HEIGHT", qMax(512U, qNextPowerOfTwo(surfacePixelSize.height() - 1)))); + // surfacePixelSize is just a hint that was passed in when initializing the + // rendercontext, likely based on the window size, if it was available, + // that is. Therefore, it may be anything, incl. zero and negative. + const int widthHint = qMax(1, surfacePixelSize.width()); + const int heightHint = qMax(1, surfacePixelSize.height()); + int w = qMin(maxSize, qt_sg_envInt("QSG_ATLAS_WIDTH", qMax(512U, qNextPowerOfTwo(widthHint - 1)))); + int h = qMin(maxSize, qt_sg_envInt("QSG_ATLAS_HEIGHT", qMax(512U, qNextPowerOfTwo(heightHint - 1)))); if (maybeSurface && maybeSurface->surfaceClass() == QSurface::Window) { QWindow *window = static_cast<QWindow *>(maybeSurface); diff --git a/src/quick/scenegraph/util/qsgtexturematerial.cpp b/src/quick/scenegraph/util/qsgtexturematerial.cpp index 82cdd03acc..92f66af011 100644 --- a/src/quick/scenegraph/util/qsgtexturematerial.cpp +++ b/src/quick/scenegraph/util/qsgtexturematerial.cpp @@ -309,6 +309,8 @@ int QSGOpaqueTextureMaterial::compare(const QSGMaterial *o) const { Q_ASSERT(o && type() == o->type()); const QSGOpaqueTextureMaterial *other = static_cast<const QSGOpaqueTextureMaterial *>(o); + Q_ASSERT(m_texture); + Q_ASSERT(other->texture()); const qint64 diff = m_texture->comparisonKey() - other->texture()->comparisonKey(); if (diff != 0) return diff < 0 ? -1 : 1; |