Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qdistancefield.cpp File Reference
#include "qdistancefield_p.h"
#include <qmath.h>
#include <private/qdatabuffer_p.h>
#include <private/qimage_p.h>
#include <private/qpathsimplifier_p.h>
+ Include dependency graph for qdistancefield.cpp:

Go to the source code of this file.

Functions

 Q_LOGGING_CATEGORY (lcDistanceField, "qt.distanceField")
 
template<FillClip clip, FillHDir dir>
void fillLine (qint32 *, int, int, int, qint32, qint32)
 
template<>
void fillLine< Clip, LeftToRight > (qint32 *line, int width, int lx, int rx, qint32 d, qint32 dd)
 
template<>
void fillLine< Clip, RightToLeft > (qint32 *line, int width, int lx, int rx, qint32 d, qint32 dd)
 
template<>
void fillLine< NoClip, LeftToRight > (qint32 *line, int, int lx, int rx, qint32 d, qint32 dd)
 
template<>
void fillLine< NoClip, RightToLeft > (qint32 *line, int, int lx, int rx, qint32 d, qint32 dd)
 
template<FillClip clip, FillVDir vDir, FillHDir hDir>
void fillLines (qint32 *bits, int width, int height, int upperY, int lowerY, int &lx, int ldx, int &rx, int rdx, qint32 &d, qint32 ddy, qint32 ddx)
 
template<FillClip clip>
void drawTriangle (qint32 *bits, int width, int height, const QPoint *center, const QPoint *v1, const QPoint *v2, qint32 value)
 
template<FillClip clip>
void drawRectangle (qint32 *bits, int width, int height, const QPoint *int1, const QPoint *center1, const QPoint *ext1, const QPoint *int2, const QPoint *center2, const QPoint *ext2, qint32 extValue)
 
static void drawPolygons (qint32 *bits, int width, int height, const QPoint *vertices, const quint32 *indices, int indexCount, qint32 value)
 
static void makeDistanceField (QDistanceFieldData *data, const QPainterPath &path, int dfScale, int offs)
 
static bool imageHasNarrowOutlines (const QImage &im)
 
static void initialDistanceFieldFactor ()
 
bool qt_fontHasNarrowOutlines (QFontEngine *fontEngine)
 
bool qt_fontHasNarrowOutlines (const QRawFont &f)
 
int QT_DISTANCEFIELD_BASEFONTSIZE (bool narrowOutlineFont)
 
int QT_DISTANCEFIELD_SCALE (bool narrowOutlineFont)
 
int QT_DISTANCEFIELD_RADIUS (bool narrowOutlineFont)
 
int QT_DISTANCEFIELD_HIGHGLYPHCOUNT ()
 

Variables

static int QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = 54
 
static int QT_DISTANCEFIELD_DEFAULT_SCALE = 16
 
static int QT_DISTANCEFIELD_DEFAULT_RADIUS = 80
 
static int QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT = 2000
 

Function Documentation

◆ drawPolygons()

static void drawPolygons ( qint32 bits,
int  width,
int  height,
const QPoint vertices,
const quint32 indices,
int  indexCount,
qint32  value 
)
static

Definition at line 401 of file qdistancefield.cpp.

References QVarLengthArray< T, Prealloc >::append(), QVarLengthArray< T, Prealloc >::data(), i, j, line, Q_ASSERT, qMax(), qMin(), qSwap(), and QVLABaseBase::size().

Referenced by makeDistanceField().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawRectangle()

template<FillClip clip>
void drawRectangle ( qint32 bits,
int  width,
int  height,
const QPoint int1,
const QPoint center1,
const QPoint ext1,
const QPoint int2,
const QPoint center2,
const QPoint ext2,
qint32  extValue 
)

Definition at line 257 of file qdistancefield.cpp.

References d, Q_ASSERT, qBound(), qSwap(), QPoint::x(), and QPoint::y().

+ Here is the call graph for this function:

◆ drawTriangle()

template<FillClip clip>
void drawTriangle ( qint32 bits,
int  width,
int  height,
const QPoint center,
const QPoint v1,
const QPoint v2,
qint32  value 
)

Definition at line 139 of file qdistancefield.cpp.

References d1, d2, and qBound().

+ Here is the call graph for this function:

◆ fillLine()

template<FillClip clip, FillHDir dir>
void fillLine ( qint32 ,
int  ,
int  ,
int  ,
qint32  ,
qint32   
)
inline

Definition at line 38 of file qdistancefield.cpp.

◆ fillLine< Clip, LeftToRight >()

template<>
void fillLine< Clip, LeftToRight > ( qint32 line,
int  width,
int  lx,
int  rx,
qint32  d,
qint32  dd 
)
inline

Definition at line 43 of file qdistancefield.cpp.

References d, line, qMax(), qMin(), and rx().

+ Here is the call graph for this function:

◆ fillLine< Clip, RightToLeft >()

template<>
void fillLine< Clip, RightToLeft > ( qint32 line,
int  width,
int  lx,
int  rx,
qint32  d,
qint32  dd 
)
inline

Definition at line 60 of file qdistancefield.cpp.

References d, line, qMax(), qMin(), and rx().

+ Here is the call graph for this function:

◆ fillLine< NoClip, LeftToRight >()

template<>
void fillLine< NoClip, LeftToRight > ( qint32 line,
int  ,
int  lx,
int  rx,
qint32  d,
qint32  dd 
)
inline

Definition at line 77 of file qdistancefield.cpp.

References d, line, and rx().

+ Here is the call graph for this function:

◆ fillLine< NoClip, RightToLeft >()

template<>
void fillLine< NoClip, RightToLeft > ( qint32 line,
int  ,
int  lx,
int  rx,
qint32  d,
qint32  dd 
)
inline

Definition at line 94 of file qdistancefield.cpp.

References d, line, and rx().

+ Here is the call graph for this function:

◆ fillLines()

template<FillClip clip, FillVDir vDir, FillHDir hDir>
void fillLines ( qint32 bits,
int  width,
int  height,
int  upperY,
int  lowerY,
int &  lx,
int  ldx,
int &  rx,
int  rdx,
qint32 d,
qint32  ddy,
qint32  ddx 
)
inline

Definition at line 111 of file qdistancefield.cpp.

References d, line, Q_ASSERT, Q_UNUSED, and rx().

+ Here is the call graph for this function:

◆ imageHasNarrowOutlines()

static bool imageHasNarrowOutlines ( const QImage im)
static

Definition at line 664 of file qdistancefield.cpp.

References QImage::height(), QImage::isNull(), QImage::pixel(), qAlpha(), qMin(), and QImage::width().

Referenced by qt_fontHasNarrowOutlines(), and qt_fontHasNarrowOutlines().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initialDistanceFieldFactor()

static void initialDistanceFieldFactor ( )
static

Definition at line 712 of file qdistancefield.cpp.

References qCDebug, qDebug, qEnvironmentVariableIntValue(), qEnvironmentVariableIsSet(), QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE, QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT, QT_DISTANCEFIELD_DEFAULT_RADIUS, and QT_DISTANCEFIELD_DEFAULT_SCALE.

Referenced by QT_DISTANCEFIELD_BASEFONTSIZE(), QT_DISTANCEFIELD_HIGHGLYPHCOUNT(), QT_DISTANCEFIELD_RADIUS(), QT_DISTANCEFIELD_SCALE(), qt_fontHasNarrowOutlines(), and qt_fontHasNarrowOutlines().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeDistanceField()

static void makeDistanceField ( QDistanceFieldData data,
const QPainterPath path,
int  dfScale,
int  offs 
)
static

Definition at line 457 of file qdistancefield.cpp.

References QVarLengthArray< T, Prealloc >::append(), QDataBuffer< Type >::at(), QVarLengthArray< T, Prealloc >::at(), QVarLengthArray< T, Prealloc >::clear(), QDataBuffer< Type >::data(), drawPolygons(), i, next, Q_ASSERT, qCos(), qDegreesToRadians(), qRound(), qSimplifyPath(), qSin(), qSqrt(), QVarLengthArray< T, Prealloc >::resize(), QPoint::rx(), QPoint::ry(), QDataBuffer< Type >::size(), QVLABaseBase::size(), QPoint::x(), and QPoint::y().

Referenced by QDistanceFieldData::create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Q_LOGGING_CATEGORY()

Q_LOGGING_CATEGORY ( lcDistanceField  ,
"qt.distanceField"   
)

◆ QT_DISTANCEFIELD_BASEFONTSIZE()

int QT_DISTANCEFIELD_BASEFONTSIZE ( bool  narrowOutlineFont)

Definition at line 773 of file qdistancefield.cpp.

References initialDistanceFieldFactor(), Q_UNLIKELY, and QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE.

Referenced by QSGDistanceFieldGlyphCache::baseFontSize(), and QDistanceField::setGlyph().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ QT_DISTANCEFIELD_HIGHGLYPHCOUNT()

int QT_DISTANCEFIELD_HIGHGLYPHCOUNT ( )

Definition at line 803 of file qdistancefield.cpp.

References initialDistanceFieldFactor(), and QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT.

Referenced by QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(), and QSGRhiDistanceFieldGlyphCache::createFullSizeTextures().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ QT_DISTANCEFIELD_RADIUS()

int QT_DISTANCEFIELD_RADIUS ( bool  narrowOutlineFont)

Definition at line 793 of file qdistancefield.cpp.

References initialDistanceFieldFactor(), Q_UNLIKELY, and QT_DISTANCEFIELD_DEFAULT_RADIUS.

Referenced by QDistanceFieldData::create(), QSGDistanceFieldGlyphCache::distanceFieldRadius(), and QSGDistanceFieldGlyphCache::setGlyphsPosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ QT_DISTANCEFIELD_SCALE()

int QT_DISTANCEFIELD_SCALE ( bool  narrowOutlineFont)

Definition at line 783 of file qdistancefield.cpp.

References initialDistanceFieldFactor(), Q_UNLIKELY, and QT_DISTANCEFIELD_DEFAULT_SCALE.

Referenced by QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(), QDistanceFieldData::create(), QSGDistanceFieldGlyphCache::distanceFieldRadius(), QSGDistanceFieldGlyphCache::glyphData(), QDistanceField::setGlyph(), and QSGDistanceFieldGlyphCache::setGlyphsPosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_fontHasNarrowOutlines() [1/2]

bool qt_fontHasNarrowOutlines ( const QRawFont f)

Definition at line 757 of file qdistancefield.cpp.

References QList< T >::at(), font, imageHasNarrowOutlines(), initialDistanceFieldFactor(), QList< T >::isEmpty(), QRawFont::PixelAntialiasing, QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE, and QFont::setPixelSize().

+ Here is the call graph for this function:

◆ qt_fontHasNarrowOutlines() [2/2]

bool qt_fontHasNarrowOutlines ( QFontEngine fontEngine)

Definition at line 738 of file qdistancefield.cpp.

References QFontEngine::alphaMapForGlyph(), QFontEngine::cloneWithSize(), QFontEngine::glyphIndex(), imageHasNarrowOutlines(), initialDistanceFieldFactor(), QBasicAtomicInteger< T >::loadRelaxed(), Q_ASSERT, QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE, and QFontEngine::ref.

Referenced by QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE

int QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = 54
static

◆ QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT

int QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT = 2000
static

◆ QT_DISTANCEFIELD_DEFAULT_RADIUS

int QT_DISTANCEFIELD_DEFAULT_RADIUS = 80
static

Definition at line 709 of file qdistancefield.cpp.

Referenced by initialDistanceFieldFactor(), and QT_DISTANCEFIELD_RADIUS().

◆ QT_DISTANCEFIELD_DEFAULT_SCALE

int QT_DISTANCEFIELD_DEFAULT_SCALE = 16
static

Definition at line 708 of file qdistancefield.cpp.

Referenced by initialDistanceFieldFactor(), and QT_DISTANCEFIELD_SCALE().