7#include <QtQuick/private/qsgdistancefieldglyphnode_p.h>
8#include <QtQuick/private/qsgcontext_p.h>
9#include <private/qrawfont_p.h>
10#include <QtGui/qguiapplication.h>
14#include <private/qquickprofiler_p.h>
15#include <QElapsedTimer>
17#include <qtquick_tracepoints_p.h>
23Q_TRACE_POINT(qtquick, QSGDistanceFieldGlyphCache_glyphRender_entry)
24Q_TRACE_POINT(qtquick, QSGDistanceFieldGlyphCache_glyphRender_exit)
25Q_TRACE_POINT(qtquick, QSGDistanceFieldGlyphCache_glyphStore_entry)
26Q_TRACE_POINT(qtquick, QSGDistanceFieldGlyphCache_glyphStore_exit)
33 : m_renderTypeQuality(renderTypeQuality)
39 m_glyphCount = fontD->fontEngine->glyphCount();
43 m_referenceFont =
font;
70 if (
data == m_glyphsData.end()) {
76 scaleDown.
scale(scaleFactor, scaleFactor);
77 gd.boundingRect = scaleDown.
mapRect(gd.path.boundingRect());
90 m.height = gd.boundingRect.height() *
scale;
91 m.baselineX = gd.boundingRect.x() *
scale;
92 m.baselineY = -gd.boundingRect.y() *
scale;
99 QSet<glyph_t> referencedGlyphs;
100 QSet<glyph_t> newGlyphs;
101 int count = glyphs.size();
105 qWarning(
"Warning: distance-field glyph is not available with index %d", glyphIndex);
111 referencedGlyphs.insert(glyphIndex);
113 if (gd.texCoord.isValid() || m_populatingGlyphs.
contains(glyphIndex))
116 m_populatingGlyphs.
insert(glyphIndex);
118 if (gd.boundingRect.isEmpty()) {
119 gd.texCoord.width = 0;
120 gd.texCoord.height = 0;
122 newGlyphs.insert(glyphIndex);
127 if (!newGlyphs.isEmpty())
133 QSet<glyph_t> unusedGlyphs;
134 int count = glyphs.size();
138 if (--gd.ref == 0 && !gd.texCoord.isNull())
139 unusedGlyphs.insert(glyphIndex);
151 m_populatingGlyphs.
clear();
158 bool profileFrames = QSG_LOG_TIME_GLYPH().isDebugEnabled();
162 Q_TRACE(QSGDistanceFieldGlyphCache_glyphRender_entry);
164 QList<QDistanceField> distanceFields;
165 const int pendingGlyphsSize = m_pendingGlyphs.
size();
166 distanceFields.reserve(pendingGlyphsSize);
167 for (
int i = 0;
i < pendingGlyphsSize; ++
i) {
170 m_pendingGlyphs.
at(
i),
180 Q_TRACE(QSGDistanceFieldGlyphCache_glyphRender_exit);
182 QQuickProfiler::SceneGraphAdaptationLayerGlyphRender);
183 Q_TRACE(QSGDistanceFieldGlyphCache_glyphStore_entry);
185 m_pendingGlyphs.
reset();
189#if defined(QSG_DISTANCEFIELD_CACHE_DEBUG)
194 if (QSG_LOG_TIME_GLYPH().isDebugEnabled()) {
197 "distancefield: %d glyphs prepared in %dms, rendering=%d, upload=%d",
200 int(renderTime / 1000000),
201 int((
now - (renderTime / 1000000))));
203 Q_TRACE(QSGDistanceFieldGlyphCache_glyphStore_exit);
205 QQuickProfiler::SceneGraphAdaptationLayerGlyphStore,
211 QVector<quint32> invalidatedGlyphs;
213 int count = glyphs.size();
218 if (!gd.texCoord.isNull())
219 invalidatedGlyphs.append(glyph.
glyph);
225 gd.texCoord.width = gd.boundingRect.width();
226 gd.texCoord.height = gd.boundingRect.height();
229 if (!invalidatedGlyphs.isEmpty()) {
230 for (QSGDistanceFieldGlyphConsumerList::iterator
iter = m_registeredNodes.
begin();
iter != m_registeredNodes.
end(); ++
iter) {
231 iter->invalidateGlyphs(invalidatedGlyphs);
243 int i = m_textures.indexOf(tex);
245 m_textures.append(tex);
246 i = m_textures.size() - 1;
248 m_textures[
i].size = tex.
size;
252 QVector<quint32> invalidatedGlyphs;
254 int count = glyphs.size();
258 if (gd.texture != &s_emptyTexture)
259 invalidatedGlyphs.append(glyphIndex);
263 if (!invalidatedGlyphs.isEmpty()) {
264 for (QSGDistanceFieldGlyphConsumerList::iterator
iter = m_registeredNodes.
begin();
iter != m_registeredNodes.
end(); ++
iter) {
265 iter->invalidateGlyphs(invalidatedGlyphs);
272 int count = glyphs.size();
274 m_pendingGlyphs.
add(glyphs.at(
i));
279 int count = m_textures.size();
284 tex.
size = newTexSize;
296 switch (
child->type()) {
367#ifndef QT_NO_DEBUG_STREAM
375 debug <<
"cvar" <<
"offset" <<
v.offset <<
"size" <<
v.size;
378 debug <<
"sampler" <<
"bindpoint" <<
v.bindPoint;
381 debug <<
"texture" <<
"bindpoint" <<
v.bindPoint;
393 debug << vd.specialType;
409#if QT_CONFIG(quick_sprite)
411QSGSpriteNode::~QSGSpriteNode()
430#include "moc_qsgadaptationlayer_p.cpp"
void setPixelSize(int)
Sets the font size to pixelSize pixels, with a maxiumum size of an unsigned 16-bit integer.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list.
iterator begin()
Returns an STL-style interator pointing to the first item in the list.
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
static QRawFontPrivate * get(const QRawFont &font)
The QRawFont class provides access to a single physical instance of a font.
QString familyName() const
Returns the family name of this QRawFont.
QPainterPath pathForGlyph(quint32 glyphIndex) const
This function returns the shape of the glyph at a given glyphIndex in the underlying font if the QRaw...
The QSGClipNode class implements the clipping functionality in the scene graph.
Metrics glyphMetrics(glyph_t glyph, qreal pixelSize)
qreal fontScale(qreal pixelSize) const
void markGlyphsToRender(const QVector< glyph_t > &glyphs)
GlyphData & emptyData(glyph_t glyph)
void setGlyphsTexture(const QVector< glyph_t > &glyphs, const Texture &tex)
void populate(const QVector< glyph_t > &glyphs)
virtual bool isActive() const
void setGlyphsPosition(const QList< GlyphPosition > &glyphs)
virtual void releaseGlyphs(const QSet< glyph_t > &glyphs)=0
void release(const QVector< glyph_t > &glyphs)
virtual void storeGlyphs(const QList< QDistanceField > &glyphs)=0
bool m_doubleGlyphResolution
void updateRhiTexture(QRhiTexture *oldTex, QRhiTexture *newTex, const QSize &newTexSize)
GlyphData & glyphData(glyph_t glyph)
virtual ~QSGDistanceFieldGlyphCache()
virtual void referenceGlyphs(const QSet< glyph_t > &glyphs)=0
virtual void processPendingGlyphs()
virtual void requestGlyphs(const QSet< glyph_t > &glyphs)=0
virtual ~QSGDistanceFieldGlyphConsumer()
The QSGDynamicTexture class serves as a baseclass for dynamically changing textures,...
The QSGGeometryNode class is used for all rendered content in the scene graph.
~QSGGuiThreadShaderEffectManager() override
~QSGInternalImageNode() override
~QSGInternalRectangleNode() override
QSGLayer(QSGTexturePrivate &dd)
virtual ~QSGNodeVisitorEx()
virtual void endVisit(QSGTransformNode *)=0
void visitChildren(QSGNode *node)
virtual bool visit(QSGTransformNode *)=0
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
QSGNode * firstChild() const
Returns the first child of this node.
The QSGOpacityNode class is used to change opacity of nodes.
~QSGPainterNode() override
The QSGRenderNode class represents a set of custom rendering commands targeting the graphics API that...
The QSGRootNode is the toplevel root of any scene graph.
~QSGShaderEffectNode() override
~QSGVisitableNode() override
virtual void accept(QSGNodeVisitorEx *)=0
bool contains(const T &value) const
iterator insert(const T &value)
QSet< QString >::iterator it
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter * iter
int QT_DISTANCEFIELD_HIGHGLYPHCOUNT()
bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine)
int QT_DISTANCEFIELD_RADIUS(bool narrowOutlineFont)
int QT_DISTANCEFIELD_SCALE(bool narrowOutlineFont)
int QT_DISTANCEFIELD_BASEFONTSIZE(bool narrowOutlineFont)
#define qCDebug(category,...)
GLsizei const GLfloat * v
[13]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLenum GLenum GLenum scale
#define Q_QUICK_SG_PROFILE_RECORD(Type, position)
#define Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(Type, position, Payload)
#define Q_QUICK_SG_PROFILE_START(Type)
QDebug operator<<(QDebug debug, const QSGGuiThreadShaderEffectManager::ShaderInfo::Variable &v)
static QT_BEGIN_NAMESPACE QElapsedTimer qsg_render_timer
#define Q_TRACE_SCOPE(x,...)
#define Q_TRACE_POINT(provider, tracepoint,...)
unsigned long long quint64