Re-enable colors with both gl and rhi glyph caches
Follow up to the 5.13->dev merge where the lack of the qt5 submodule update made it impossible to use the new color argument. Also implements the color argument for the rhi variant of the glyph cache. Change-Id: Ie6c6ba3d647335eb6173d0c9f7fbe3a4ed6b1f24 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
3cff8b2718
commit
1d9645576e
|
@ -764,13 +764,13 @@ void QSGTextMaskMaterial::updateCache(QFontEngine::GlyphFormat glyphFormat)
|
|||
if (!fontEngine->supportsTransformation(glyphCacheTransform))
|
||||
glyphCacheTransform = QTransform();
|
||||
|
||||
//QColor color = glyphFormat == QFontEngine::Format_ARGB ? QColor::fromRgbF(m_color.x(), m_color.y(), m_color.z(), m_color.w()) : QColor();
|
||||
m_glyphCache = fontEngine->glyphCache(cacheKey, glyphFormat, glyphCacheTransform); // ### restore color arg when merges are done
|
||||
QColor color = glyphFormat == QFontEngine::Format_ARGB ? QColor::fromRgbF(m_color.x(), m_color.y(), m_color.z(), m_color.w()) : QColor();
|
||||
m_glyphCache = fontEngine->glyphCache(cacheKey, glyphFormat, glyphCacheTransform, color);
|
||||
if (!m_glyphCache || int(m_glyphCache->glyphFormat()) != glyphFormat) {
|
||||
if (m_rhi)
|
||||
m_glyphCache = new QSGRhiTextureGlyphCache(m_rhi, glyphFormat, glyphCacheTransform); // ### color
|
||||
m_glyphCache = new QSGRhiTextureGlyphCache(m_rhi, glyphFormat, glyphCacheTransform, color);
|
||||
else
|
||||
m_glyphCache = new QOpenGLTextureGlyphCache(glyphFormat, glyphCacheTransform); // ### restore color arg when merges are done
|
||||
m_glyphCache = new QOpenGLTextureGlyphCache(glyphFormat, glyphCacheTransform, color);
|
||||
|
||||
fontEngine->setGlyphCache(cacheKey, m_glyphCache.data());
|
||||
m_rc->registerFontengineForCleanup(fontEngine);
|
||||
|
|
|
@ -43,8 +43,9 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QSGRhiTextureGlyphCache::QSGRhiTextureGlyphCache(QRhi *rhi, QFontEngine::GlyphFormat format, const QTransform &matrix)
|
||||
: QImageTextureGlyphCache(format, matrix),
|
||||
QSGRhiTextureGlyphCache::QSGRhiTextureGlyphCache(QRhi *rhi, QFontEngine::GlyphFormat format, const QTransform &matrix,
|
||||
const QColor &color)
|
||||
: QImageTextureGlyphCache(format, matrix, color),
|
||||
m_rhi(rhi)
|
||||
{
|
||||
// Some OpenGL implementations, for instance macOS, have issues with
|
||||
|
|
|
@ -59,7 +59,8 @@ QT_BEGIN_NAMESPACE
|
|||
class QSGRhiTextureGlyphCache : public QImageTextureGlyphCache
|
||||
{
|
||||
public:
|
||||
QSGRhiTextureGlyphCache(QRhi *rhi, QFontEngine::GlyphFormat format, const QTransform &matrix);
|
||||
QSGRhiTextureGlyphCache(QRhi *rhi, QFontEngine::GlyphFormat format, const QTransform &matrix,
|
||||
const QColor &color = QColor());
|
||||
~QSGRhiTextureGlyphCache();
|
||||
|
||||
void createTextureData(int width, int height) override;
|
||||
|
|
Loading…
Reference in New Issue