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
113 }
else if (
img->depth() == 32) {
117 for (
int y = 0;
y < maskHeight; ++
y) {
119 for (
int x = 0;
x < maskWidth; ++
x) {
125 avg = (
r +
g +
b + 1) / 3;
130#if Q_BYTE_ORDER != Q_BIG_ENDIAN
150 if (!m_resizeWithTextureCopy) {
159 prepareGlyphImage(&
mask);
178 m_texture = createEmptyTexture(texFormat);
205 if (!m_resizeWithTextureCopy)
214 mergeInto->
merge(resourceUpdates);
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
@ Format_ARGB32_Premultiplied
\inmodule QtCore\reentrant
void merge(QRhiResourceUpdateBatch *other)
Copies all queued operations from the other batch into this one.
void uploadTexture(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
Enqueues uploading the image data for one or more mip levels in one or more layers of the texture tex...
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 setSourceTopLeft(const QPoint &p)
Sets the source top-left position p.
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)
constexpr int qAlpha(QRgb rgb)