Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qtransform.cpp File Reference
#include "qtransform.h"
#include "qdatastream.h"
#include "qdebug.h"
#include "qhashfunctions.h"
#include "qregion.h"
#include "qpainterpath.h"
#include "qpainterpath_p.h"
#include "qvariant.h"
#include "qmath_p.h"
#include <qnumeric.h>
#include <private/qbezier_p.h>
+ Include dependency graph for qtransform.cpp:

Go to the source code of this file.

Classes

struct  QHomogeneousCoordinate
 

Macros

#define Q_NEAR_CLIP   (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)
 
#define MAP(x, y, nx, ny)
 

Functions

QT_BEGIN_NAMESPACE static Q_NEVER_INLINE void nanWarning (const char *func)
 
QDataStreamoperator<< (QDataStream &s, const QTransform &m)
 
QDataStreamoperator>> (QDataStream &s, QTransform &t)
 
QDebug operator<< (QDebug dbg, const QTransform &m)
 
static QPolygonF mapProjective (const QTransform &transform, const QPolygonF &poly)
 
QPainterPath qt_regionToPath (const QRegion &region)
 
static QHomogeneousCoordinate mapHomogeneous (const QTransform &transform, const QPointF &p)
 
static bool lineTo_clipped (QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b, bool needsMoveTo, bool needsLineTo=true)
 
Q_GUI_EXPORT bool qt_scaleForTransform (const QTransform &transform, qreal *scale)
 
static bool cubicTo_clipped (QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b, const QPointF &c, const QPointF &d, bool needsMoveTo)
 
static QPainterPath mapProjective (const QTransform &transform, const QPainterPath &path)
 
static bool needsPerspectiveClipping (const QRectF &rect, const QTransform &transform)
 
QDataStreamoperator>> (QDataStream &s, QTransform::Affine &m)
 
QDataStreamoperator<< (QDataStream &s, const QTransform::Affine &m)
 

Macro Definition Documentation

◆ MAP

#define MAP (   x,
  y,
  nx,
  ny 
)
Value:
do { \
qreal FX_ = x; \
qreal FY_ = y; \
switch(t) { \
case TxNone: \
nx = FX_; \
ny = FY_; \
break; \
case TxTranslate: \
nx = FX_ + m_matrix[2][0]; \
ny = FY_ + m_matrix[2][1]; \
break; \
case TxScale: \
nx = m_matrix[0][0] * FX_ + m_matrix[2][0]; \
ny = m_matrix[1][1] * FY_ + m_matrix[2][1]; \
break; \
case TxRotate: \
case TxShear: \
case TxProject: \
nx = m_matrix[0][0] * FX_ + m_matrix[1][0] * FY_ + m_matrix[2][0]; \
ny = m_matrix[0][1] * FX_ + m_matrix[1][1] * FY_ + m_matrix[2][1]; \
if (t == TxProject) { \
qreal w = (m_matrix[0][2] * FX_ + m_matrix[1][2] * FY_ + m_matrix[2][2]); \
w = 1./w; \
nx *= w; \
ny *= w; \
} \
} \
} while (0)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint y
GLbyte nx
GLfixed ny
GLdouble GLdouble t
Definition qopenglext.h:243
#define Q_NEAR_CLIP
double qreal
Definition qtypes.h:92

Definition at line 32 of file qtransform.cpp.

◆ Q_NEAR_CLIP

#define Q_NEAR_CLIP   (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)

Definition at line 27 of file qtransform.cpp.

Function Documentation

◆ cubicTo_clipped()

static bool cubicTo_clipped ( QPainterPath path,
const QTransform transform,
const QPointF a,
const QPointF b,
const QPointF c,
const QPointF d,
bool  needsMoveTo 
)
inlinestatic

Definition at line 1590 of file qtransform.cpp.

References d, QBezier::fromPoints(), i, lineTo_clipped(), qt_scaleForTransform(), and QBezier::toPolygon().

Referenced by mapProjective().

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

◆ lineTo_clipped()

static bool lineTo_clipped ( QPainterPath path,
const QTransform transform,
const QPointF a,
const QPointF b,
bool  needsMoveTo,
bool  needsLineTo = true 
)
inlinestatic

Definition at line 1549 of file qtransform.cpp.

References mapHomogeneous(), Q_NEAR_CLIP, QHomogeneousCoordinate::toPoint(), QHomogeneousCoordinate::w, QHomogeneousCoordinate::x, and QHomogeneousCoordinate::y.

Referenced by cubicTo_clipped(), and mapProjective().

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

◆ mapHomogeneous()

static QHomogeneousCoordinate mapHomogeneous ( const QTransform transform,
const QPointF p 
)
inlinestatic

Definition at line 1540 of file qtransform.cpp.

Referenced by lineTo_clipped().

+ Here is the caller graph for this function:

◆ mapProjective() [1/2]

static QPainterPath mapProjective ( const QTransform transform,
const QPainterPath path 
)
static

Definition at line 1609 of file qtransform.cpp.

References cubicTo_clipped(), QPainterPath::CurveToElement, i, lineTo_clipped(), QPainterPath::LineToElement, QPainterPath::MoveToElement, and Q_ASSERT.

+ Here is the call graph for this function:

◆ mapProjective() [2/2]

static QPolygonF mapProjective ( const QTransform transform,
const QPolygonF poly 
)
static

Definition at line 1367 of file qtransform.cpp.

References QList< T >::at(), i, and QList< T >::size().

Referenced by QTransform::map(), QTransform::map(), and QTransform::map().

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

◆ nanWarning()

QT_BEGIN_NAMESPACE static Q_NEVER_INLINE void nanWarning ( const char *  func)
static

Definition at line 21 of file qtransform.cpp.

References qWarning.

Referenced by QTransform::fromScale(), QTransform::fromTranslate(), QTransform::rotate(), QTransform::rotateRadians(), QTransform::scale(), QTransform::shear(), and QTransform::translate().

+ Here is the caller graph for this function:

◆ needsPerspectiveClipping()

static bool needsPerspectiveClipping ( const QRectF rect,
const QTransform transform 
)
inlinestatic

Definition at line 1885 of file qtransform.cpp.

References Q_NEAR_CLIP, qMin(), and rect.

Referenced by QTransform::mapRect(), and QTransform::mapRect().

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

◆ operator<<() [1/3]

QDataStream & operator<< ( QDataStream s,
const QTransform m 
)
related

Definition at line 1052 of file qtransform.cpp.

◆ operator<<() [2/3]

QDataStream & operator<< ( QDataStream s,
const QTransform::Affine &  m 
)

Definition at line 2368 of file qtransform.cpp.

◆ operator<<() [3/3]

QDebug operator<< ( QDebug  dbg,
const QTransform m 
)

Definition at line 1100 of file qtransform.cpp.

References typeStr().

+ Here is the call graph for this function:

◆ operator>>() [1/2]

QDataStream & operator>> ( QDataStream s,
QTransform t 
)
related

Definition at line 1076 of file qtransform.cpp.

◆ operator>>() [2/2]

QDataStream & operator>> ( QDataStream s,
QTransform::Affine &  m 
)

Definition at line 2342 of file qtransform.cpp.

◆ qt_regionToPath()

QPainterPath qt_regionToPath ( const QRegion region)

Definition at line 1007 of file qregion.cpp.

◆ qt_scaleForTransform()

Q_GUI_EXPORT bool qt_scaleForTransform ( const QTransform transform,
qreal scale 
)

Definition at line 2301 of file qtransform.cpp.

References qAbs(), qFuzzyCompare(), qMax(), qSqrt(), QTransform::TxRotate, QTransform::TxScale, and QTransform::TxTranslate.

Referenced by cubicTo_clipped(), QCoreTextFontEngine::draw(), QPixmapBlurFilter::draw(), QCoreTextFontEngine::imageForGlyph(), QStrokerOps::setCurveThresholdFromTransform(), QOutlineMapper::setMatrix(), QOpenGL2PaintEngineEx::stroke(), QRasterPaintEngine::updateMatrix(), and QX11PaintEngine::updateMatrix().

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