diff options
Diffstat (limited to 'src/plugins/terminal/glyphcache.h')
-rw-r--r-- | src/plugins/terminal/glyphcache.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/plugins/terminal/glyphcache.h b/src/plugins/terminal/glyphcache.h new file mode 100644 index 00000000000..60701098f5f --- /dev/null +++ b/src/plugins/terminal/glyphcache.h @@ -0,0 +1,34 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 + +#pragma once + +#include <QCache> +#include <QFont> +#include <QGlyphRun> +#include <QString> + +namespace Terminal::Internal { + +struct GlyphCacheKey +{ + QFont font; + QString text; + + bool operator==(const GlyphCacheKey &other) const + { + return font == other.font && text == other.text; + } +}; + +class GlyphCache : public QCache<GlyphCacheKey, QGlyphRun> +{ +public: + using QCache::QCache; + + static GlyphCache &instance(); + + const QGlyphRun *get(const QFont &font, const QString &text); +}; + +} // namespace Terminal::Internal |