44 #include <private/qpainterpath_p.h>
45 #include <private/qfontengine_p.h>
46 #include <private/qstatictext_p.h>
54 #if !defined(QT_MAX_CACHED_GLYPH_SIZE)
55 # define QT_MAX_CACHED_GLYPH_SIZE 64
69 e->cleanup(
e->engine,
e->data);
84 m_cp_rect.
x1 = m_cp_rect.
x2 = m_cp_rect.
y1 = m_cp_rect.
y2 = 0;
90 const qreal *pts = m_points;
91 m_cp_rect.
x1 = m_cp_rect.
x2 = *pts;
93 m_cp_rect.
y1 = m_cp_rect.
y2 = *pts;
96 const qreal *epts = m_points + (m_count << 1);
99 if (
x < m_cp_rect.
x1) m_cp_rect.
x1 =
x;
100 else if (
x > m_cp_rect.
x2) m_cp_rect.
x2 =
x;
104 if (
y < m_cp_rect.
y1) m_cp_rect.
y1 =
y;
105 else if (
y > m_cp_rect.
y2) m_cp_rect.
y2 =
y;
134 return path.d_func()->vectorPath();
137 #ifndef QT_NO_DEBUG_STREAM
142 s <<
"QVectorPath(size:" <<
path.elementCount()
192 if (
info.matrix !=
q->state()->matrix) {
193 q->state()->matrix =
info.matrix;
194 q->transformChanged();
197 switch (
info.clipType) {
223 q->transformChanged();
236 return !
p->d_ptr->state->clipInfo.isEmpty();
391 qDebug() <<
"QPaintEngineEx::stroke()" << inPen;
399 if (!
d->strokeHandler) {
401 d->stroker.setMoveToHook(qpaintengineex_moveTo);
402 d->stroker.setLineToHook(qpaintengineex_lineTo);
403 d->stroker.setCubicToHook(qpaintengineex_cubicTo);
412 clipRect =
d->exDeviceRect;
421 qreal patternLength = 0;
423 const int patternSize = qMin(
pattern.size(), 32);
424 for (
int i = 0;
i < patternSize;
i++)
445 d->stroker.setStrokeWidth(1);
447 d->stroker.setStrokeWidth(penWidth);
451 d->activeStroker = &
d->stroker;
453 d->activeStroker =
nullptr;
457 d->activeStroker = &
d->dasher;
461 if (!
d->activeStroker) {
466 d->activeStroker->setClipRect(clipRect);
468 if (
d->activeStroker == &
d->stroker)
469 d->stroker.setForceOpen(
path.hasExplicitOpen());
473 int pointCount =
path.elementCount();
477 d->strokeHandler->types.reset();
478 d->strokeHandler->pts.reset();
483 if (
path.elementCount() > 2)
495 d->activeStroker->setCurveThresholdFromTransform(
state()->
matrix);
496 d->activeStroker->begin(
d->strokeHandler);
498 while (
points < lastPoint) {
522 if (
path.hasImplicitClose())
523 d->activeStroker->lineTo(
path.points()[0],
path.points()[1]);
528 while (
points < lastPoint) {
532 if (
path.hasImplicitClose())
533 d->activeStroker->lineTo(
path.points()[0],
path.points()[1]);
535 d->activeStroker->end();
537 if (!
d->strokeHandler->types.size())
541 d->strokeHandler->types.size(),
542 d->strokeHandler->types.data(),
549 d->activeStroker->strokePath(painterPath,
d->strokeHandler,
QTransform());
551 d->activeStroker->setCurveThresholdFromTransform(
QTransform());
552 d->activeStroker->begin(
d->strokeHandler);
554 while (
points < lastPoint) {
558 d->activeStroker->moveTo(pt.
x(), pt.
y());
565 d->activeStroker->lineTo(pt.
x(), pt.
y());
574 d->activeStroker->cubicTo(c1.
x(), c1.
y(),
c2.x(),
c2.y(),
e.x(),
e.y());
584 if (
path.hasImplicitClose()) {
586 d->activeStroker->lineTo(pt.
x(), pt.
y());
591 d->activeStroker->moveTo(
p.x(),
p.y());
593 while (
points < lastPoint) {
595 d->activeStroker->lineTo(
p.x(),
p.y());
598 if (
path.hasImplicitClose())
599 d->activeStroker->lineTo(
p.x(),
p.y());
601 d->activeStroker->end();
605 d->strokeHandler->types.size(),
606 d->strokeHandler->types.data(),
651 const auto rectsInRegion = region.
rectCount();
652 if (rectsInRegion == 1) {
654 }
else if (rectsInRegion <= 32) {
675 QVectorPath vp(pts, rectsInRegion * 4, qpaintengineex_rect4_types_32);
715 if (
path.isEmpty()) {
725 qreal pts[] = {
r.x(),
r.y(),
r.x() +
r.width(),
r.y(),
726 r.x() +
r.width(),
r.y() +
r.height(),
r.x(),
r.y() +
r.height() };
738 for (
int i=0;
i<rectCount; ++
i) {
755 for (
int i=0;
i<rectCount; ++
i) {
779 xRadius = xRadius *
rect.width() / 200.;
780 yRadius = yRadius *
rect.height() / 200.;
783 xRadius = qMin(xRadius,
rect.width() / 2);
784 yRadius = qMin(yRadius,
rect.height() / 2);
814 int elementCount = lineCount << 1;
815 while (elementCount > 0) {
816 int count = qMin(elementCount, 32);
819 int count2 =
count<<1;
820 for (
int i=0;
i<count2; ++
i)
821 pts[
i] = ((
const int *) lines)[
i];
833 int elementCount = lineCount << 1;
834 while (elementCount > 0) {
835 int count = qMin(elementCount, 32);
857 if (point_count == 0)
882 while (pointCount > 0) {
883 int count = qMin(pointCount, 16);
889 pts[++oset] =
points[
i].x() + 1/63.;
898 for (
int i=0;
i<pointCount; ++
i) {
913 while (pointCount > 0) {
914 int count = qMin(pointCount, 16);
920 pts[++oset] =
points[
i].x() + 1/63.;
929 for (
int i=0;
i<pointCount; ++
i) {
953 int count = pointCount<<1;
987 r.x() +
r.width(),
r.y(),
988 r.x() +
r.width(),
r.y() +
r.height(),
989 r.x(),
r.y() +
r.height() };
1004 for (
int i = 0;
i < fragmentCount; ++
i) {
1015 QRectF sourceRect(fragments[
i].sourceLeft, fragments[
i].sourceTop,
1045 for (
int i=0;
i<
path.elementCount(); ++
i) {
1059 p.cubicTo(
p1,
p2, p3);
1071 for (
int i=1;
i<
path.elementCount(); ++
i) {
1093 if (!
path.isEmpty()) {
1095 QPainter::RenderHints oldHints =
s->renderHints;
1096 bool changedHints =
false;
1102 changedHints =
true;
1108 s->renderHints = oldHints;
1124 static const int maxCachedGlyphSizeSquared = std::pow([]{
1125 if (
int env = qEnvironmentVariableIntValue(
"QT_MAX_CACHED_GLYPH_SIZE"))
1131 return (pixelSize * pixelSize *
qAbs(
m.determinant())) <= maxCachedGlyphSizeSquared;
small capitals from c petite p scientific i
[1]
The QBrush class defines the fill pattern of shapes drawn by QPainter.
The QColor class provides colors based on RGB, HSV or CMYK values.
static int repetitionLimit()
operator<<(QDataStream &ds, qfloat16 f)
The QDebug class provides an output stream for debugging information.
Convenience class for custom QDebug operators.
virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags)
The QImage class provides a hardware-independent image representation that allows direct access to th...
The QLineF class provides a two-dimensional vector using floating point precision.
The QLine class provides a two-dimensional vector using integer precision.
virtual void drawRects(const QRect *rects, int rectCount) override
virtual void renderHintsChanged()=0
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QFlags< QPainter::PixmapFragmentHint > hints)
virtual void stroke(const QVectorPath &path, const QPen &pen)
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override
virtual void drawEllipse(const QRectF &r) override
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor) override=0
virtual void drawLines(const QLine *lines, int lineCount) override
virtual void clip(const QVectorPath &path, Qt::ClipOperation op)=0
virtual void fill(const QVectorPath &path, const QBrush &brush)=0
virtual void opacityChanged()=0
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override=0
virtual QPainterState * createState(QPainterState *orig) const
virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override
virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode)
virtual bool requiresPretransformedGlyphPositions(QFontEngine *fontEngine, const QTransform &m) const
virtual void draw(const QVectorPath &path)
virtual void fillRect(const QRectF &rect, const QBrush &brush)
virtual void updateState(const QPaintEngineState &state) override
virtual void transformChanged()=0
virtual bool shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const
virtual void setState(QPainterState *s)
virtual void drawPoints(const QPointF *points, int pointCount) override
virtual void drawPath(const QPainterPath &path) override
virtual void drawStaticTextItem(QStaticTextItem *)
StrokeHandler * strokeHandler
bool hasClipOperations() const
void replayClipOperations()
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
QPaintEngineState * state
The QPaintEngineState class provides information about the active paint engine's current state....
This class is used in conjunction with the QPainter::drawPixmapFragments() function to specify how a ...
The QPainter class performs low-level painting on widgets and other paint devices.
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
The QPen class defines how a QPainter should draw lines and outlines of shapes.
void setCapStyle(Qt::PenCapStyle pcs)
void setStyle(Qt::PenStyle)
[0]
QList< qreal > dashPattern() const
Qt::PenCapStyle capStyle() const
void setColor(const QColor &color)
Qt::PenJoinStyle joinStyle() const
Qt::PenStyle style() const
The QPixmap class is an off-screen image representation that can be used as a paint device.
QSizeF deviceIndependentSize() const
The QPointF class defines a point in the plane using floating point precision.
constexpr qreal x() const noexcept
constexpr qreal y() const noexcept
The QPoint class defines a point in the plane using integer precision.
The QRectF class defines a finite rectangle in the plane using floating point precision.
constexpr qreal height() const noexcept
constexpr qreal width() const noexcept
constexpr QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept
constexpr bool isNull() const noexcept
constexpr void translate(qreal dx, qreal dy) noexcept
The QRect class defines a rectangle in the plane using integer precision.
The QRegion class specifies a clip region for a painter.
int rectCount() const noexcept
const_iterator begin() const noexcept
QFixedPoint * glyphPositions
QFontEngine * fontEngine() const
static uint polygonFlags(QPaintEngine::PolygonDrawMode mode)
CacheEntry * lookupCacheData(QPaintEngineEx *engine) const
CacheEntry * addCacheData(QPaintEngineEx *engine, void *data, qvectorpath_cache_cleanup cleanup) const
QRectF controlPointRect() const
backing_store_ptr info
[4]
QTextStream & hex(QTextStream &stream)
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld cleanup[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld SRC pixld MASK if DST_R else pixld DST_R endif if src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head if pixblock_size cache_preload_simple endif process_pixblock_tail pixinterleave dst_w_basereg irp if pixblock_size chunk_size tst beq if DST_W else pixst DST_W else mov ORIG_W endif add lsl if lsl endif if lsl endif lsl endif lsl endif lsl endif subs mov DST_W if regs_shortage str endif bge start_of_loop_label endm macro generate_composite_function
set set set set set set set macro pixldst1 op
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
QT_END_INCLUDE_NAMESPACE typedef double qreal
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLuint GLfloat GLfloat GLfloat x1
GLsizei GLenum GLenum * types
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum GLenum transform
GLfixed GLfixed GLint GLint GLfixed points
GLfixed GLfixed GLfixed y2
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
GLenum GLenum GLenum GLenum GLenum scale
Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale)
#define QT_MAX_CACHED_GLYPH_SIZE
Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path)
const QVectorPath & qtVectorPathForPath(const QPainterPath &path)
Qt::BrushStyle qbrush_style(const QBrush &b)
bool qpen_fast_equals(const QPen &a, const QPen &b)
Qt::PenStyle qpen_style(const QPen &p)
QBrush qpen_brush(const QPen &p)
QPointF qt_curves_for_arc(const QRectF &rect, qreal startAngle, qreal sweepLength, QPointF *curves, int *point_count)
void(* qvectorpath_cache_cleanup)(QPaintEngineEx *engine, void *data)
StrokeHandler(int reserve)
QDataBuffer< QPainterPath::ElementType > types