7#include <private/qdrawhelper_p.h>
33 qWarning(
"Failed to build new glyph cache texture of size %dx%d", m_size.
width(), m_size.
height());
47 subresDesc.setSourceSize(m_size);
58 if (!m_resizeWithTextureCopy)
80 if (m_resizeWithTextureCopy) {
85 prepareGlyphImage(&
img);
102void QSGRhiTextureGlyphCache::prepareGlyphImage(
QImage *
img)
104 const int maskWidth =
img->width();
105 const int maskHeight =
img->height();
106#if Q_BYTE_ORDER != Q_BIG_ENDIAN
121 for (
int y = 0;
y < maskHeight; ++
y) {
123 for (
int x = 0;
x < maskWidth; ++
x) {
130 int avg = (
r +
g +
b + 1) / 3;
134#if Q_BYTE_ORDER != Q_BIG_ENDIAN
144#if Q_BYTE_ORDER != Q_BIG_ENDIAN
156 if (!m_resizeWithTextureCopy) {
165 prepareGlyphImage(&
mask);
184 m_texture = createEmptyTexture(texFormat);
191 desc.setEntries(m_uploads.
cbegin(), m_uploads.
cend());
192 resourceUpdates->uploadTexture(m_texture, desc);
211 if (!m_resizeWithTextureCopy)
220 mergeInto->merge(resourceUpdates);
QByteArray & fill(char c, qsizetype size=-1)
Sets every byte in the byte array to ch.
The QColor class provides colors based on RGB, HSV or CMYK values.
QFontEngine::GlyphFormat m_format
virtual void createTextureData(int width, int height) override
virtual void resizeTextureData(int width, int height) override
const QImage & image() const
virtual void fillTexture(const Coord &c, glyph_t glyph, const QFixedPoint &subPixelPosition) override
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
@ Format_ARGB32_Premultiplied
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
void copyTexture(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc=QRhiTextureCopyDescription())
Enqueues a texture-to-texture copy operation from src into dst as described by desc.
void setDestinationTopLeft(const QPoint &p)
Sets the destination top-left position p.
void setSourceSize(const QSize &size)
Sets the source size in pixels.
void setImage(const QImage &image)
Sets image.
Format
Specifies the texture format.
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags={}) const
int resourceLimit(ResourceLimit limit) const
bool isFeatureSupported(QRhi::Feature feature) const
Implementation backend() const
QRhiTexture * newTexture(QRhiTexture::Format format, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
void deferredReleaseGlyphCacheTexture(QRhiTexture *texture)
QRhiResourceUpdateBatch * maybeGlyphCacheResourceUpdates()
void resetGlyphCacheResources()
QRhiResourceUpdateBatch * glyphCacheResourceUpdates()
~QSGRhiTextureGlyphCache()
void resizeTextureData(int width, int height) override
void commitResourceUpdates(QRhiResourceUpdateBatch *mergeInto)
void endFillTexture() override
void beginFillTexture() override
int glyphPadding() const override
int maxTextureHeight() const override
QSGRhiTextureGlyphCache(QSGDefaultRenderContext *rc, QFontEngine::GlyphFormat format, const QTransform &matrix, const QColor &color=QColor())
bool eightBitFormatIsAlphaSwizzled() const
int maxTextureWidth() const override
void fillTexture(const Coord &c, glyph_t glyph, const QFixedPoint &subPixelPosition) override
void createTextureData(int width, int height) override
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
QImage textureMapForGlyph(glyph_t g, const QFixedPoint &subPixelPosition) const
const_iterator cbegin() const noexcept
const_iterator cend() const noexcept
Combined button and popup list for selecting options.
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
static quint32 ARGB2RGBA(quint32 x)
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
constexpr int qRed(QRgb rgb)
constexpr int qGreen(QRgb rgb)
constexpr QRgb qRgba(int r, int g, int b, int a)
constexpr int qBlue(QRgb rgb)