aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphcache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphcache.cpp')
-rw-r--r--src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphcache.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphcache.cpp b/src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphcache.cpp
index 5401f056d0..373e16d7c4 100644
--- a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphcache.cpp
+++ b/src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphcache.cpp
@@ -64,24 +64,36 @@ QSGD3D12GlyphCache::~QSGD3D12GlyphCache()
void QSGD3D12GlyphCache::createTextureData(int width, int height)
{
+ width = qMax(128, width);
+ height = qMax(32, height);
+
m_id = m_engine->genTexture();
Q_ASSERT(m_id);
if (Q_UNLIKELY(debug_render()))
- qDebug("new glyph cache texture %u of size %dx%d", m_id, width, height);
+ qDebug("new glyph cache texture %u of size %dx%d, fontengine format %d", m_id, width, height, m_format);
m_size = QSize(width, height);
- m_engine->createTexture(m_id, m_size, QImage::Format_ARGB32_Premultiplied, QSGD3D12Engine::CreateWithAlpha);
+
+ const QImage::Format imageFormat =
+ m_format == QFontEngine::Format_A8 ? QImage::Format_Alpha8 : QImage::Format_ARGB32_Premultiplied;
+ m_engine->createTexture(m_id, m_size, imageFormat, QSGD3D12Engine::CreateWithAlpha);
}
void QSGD3D12GlyphCache::resizeTextureData(int width, int height)
{
+ width = qMax(128, width);
+ height = qMax(32, height);
+
+ if (m_size.width() >= width && m_size.height() >= height)
+ return;
+
if (Q_UNLIKELY(debug_render()))
qDebug("glyph cache texture %u resize to %dx%d", m_id, width, height);
m_size = QSize(width, height);
- m_engine->queueResizeTexture(m_id, m_size);
+ m_engine->queueTextureResize(m_id, m_size);
}
void QSGD3D12GlyphCache::beginFillTexture()