8#include <private/qpainterpath_p.h>
9#include <private/qfontengine_p.h>
10#include <private/qstatictext_p.h>
18#if !defined(QT_MAX_CACHED_GLYPH_SIZE)
19# define QT_MAX_CACHED_GLYPH_SIZE 64
33 e->cleanup(
e->engine,
e->data);
48 m_cp_rect.
x1 = m_cp_rect.
x2 = m_cp_rect.
y1 = m_cp_rect.
y2 = 0;
54 const qreal *pts = m_points;
55 m_cp_rect.
x1 = m_cp_rect.
x2 = *pts;
57 m_cp_rect.
y1 = m_cp_rect.
y2 = *pts;
60 const qreal *epts = m_points + (m_count << 1);
63 if (
x < m_cp_rect.
x1) m_cp_rect.
x1 =
x;
64 else if (
x > m_cp_rect.
x2) m_cp_rect.
x2 =
x;
68 if (
y < m_cp_rect.
y1) m_cp_rect.
y1 =
y;
69 else if (
y > m_cp_rect.
y2) m_cp_rect.
y2 =
y;
98 return path.d_func()->vectorPath();
101#ifndef QT_NO_DEBUG_STREAM
106 s <<
"QVectorPath(size:" <<
path.elementCount()
131 strokerPen(
Qt::NoPen)
156 if (
info.matrix !=
q->state()->matrix) {
157 q->state()->matrix =
info.matrix;
158 q->transformChanged();
161 switch (
info.clipType) {
187 q->transformChanged();
200 return !
p->d_ptr->state->clipInfo.isEmpty();
355 qDebug() <<
"QPaintEngineEx::stroke()" << inPen;
363 if (!
d->strokeHandler) {
376 clipRect =
d->exDeviceRect;
385 qreal patternLength = 0;
388 for (
int i = 0;
i < patternSize;
i++)
409 d->stroker.setStrokeWidth(1);
411 d->stroker.setStrokeWidth(penWidth);
415 d->activeStroker = &
d->stroker;
417 d->activeStroker =
nullptr;
421 d->activeStroker = &
d->dasher;
425 if (!
d->activeStroker) {
430 d->activeStroker->setClipRect(clipRect);
432 if (
d->activeStroker == &
d->stroker)
433 d->stroker.setForceOpen(
path.hasExplicitOpen());
437 int pointCount =
path.elementCount();
441 d->strokeHandler->types.reset();
442 d->strokeHandler->pts.reset();
447 if (
path.elementCount() > 2)
459 d->activeStroker->setCurveThresholdFromTransform(
state()->
matrix);
460 d->activeStroker->begin(
d->strokeHandler);
462 while (
points < lastPoint) {
486 if (
path.hasImplicitClose())
487 d->activeStroker->lineTo(
path.points()[0],
path.points()[1]);
492 while (
points < lastPoint) {
496 if (
path.hasImplicitClose())
497 d->activeStroker->lineTo(
path.points()[0],
path.points()[1]);
499 d->activeStroker->end();
501 if (!
d->strokeHandler->types.size())
505 d->strokeHandler->types.size(),
506 d->strokeHandler->types.data(),
513 d->activeStroker->strokePath(painterPath,
d->strokeHandler,
QTransform());
515 d->activeStroker->setCurveThresholdFromTransform(
QTransform());
516 d->activeStroker->begin(
d->strokeHandler);
518 while (
points < lastPoint) {
522 d->activeStroker->moveTo(pt.
x(), pt.
y());
529 d->activeStroker->lineTo(pt.
x(), pt.
y());
538 d->activeStroker->cubicTo(c1.
x(), c1.
y(),
c2.x(),
c2.y(),
e.x(),
e.y());
548 if (
path.hasImplicitClose()) {
550 d->activeStroker->lineTo(pt.
x(), pt.
y());
555 d->activeStroker->moveTo(
p.x(),
p.y());
557 while (
points < lastPoint) {
559 d->activeStroker->lineTo(
p.x(),
p.y());
562 if (
path.hasImplicitClose())
563 d->activeStroker->lineTo(
p.x(),
p.y());
565 d->activeStroker->end();
569 d->strokeHandler->types.size(),
570 d->strokeHandler->types.data(),
615 const auto rectsInRegion = region.
rectCount();
616 if (rectsInRegion == 1) {
618 }
else if (rectsInRegion <= 32) {
679 if (
path.isEmpty()) {
689 qreal pts[] = {
r.x(),
r.y(),
r.x() +
r.width(),
r.y(),
690 r.x() +
r.width(),
r.y() +
r.height(),
r.x(),
r.y() +
r.height() };
702 for (
int i=0;
i<rectCount; ++
i) {
719 for (
int i=0;
i<rectCount; ++
i) {
743 xRadius = xRadius *
rect.width() / 200.;
744 yRadius = yRadius *
rect.height() / 200.;
747 xRadius =
qMin(xRadius,
rect.width() / 2);
748 yRadius =
qMin(yRadius,
rect.height() / 2);
778 int elementCount = lineCount << 1;
779 while (elementCount > 0) {
783 int count2 =
count<<1;
784 for (
int i=0;
i<count2; ++
i)
785 pts[
i] = ((
const int *) lines)[
i];
797 int elementCount = lineCount << 1;
798 while (elementCount > 0) {
821 if (point_count == 0)
846 while (pointCount > 0) {
853 pts[++oset] =
points[
i].x() + 1/63.;
862 for (
int i=0;
i<pointCount; ++
i) {
877 while (pointCount > 0) {
884 pts[++oset] =
points[
i].x() + 1/63.;
893 for (
int i=0;
i<pointCount; ++
i) {
905 Q_ASSUME(pointCount >= 2);
916 Q_ASSUME(pointCount >= 2);
917 int count = pointCount<<1;
951 r.x() +
r.width(),
r.y(),
952 r.x() +
r.width(),
r.y() +
r.height(),
953 r.x(),
r.y() +
r.height() };
968 for (
int i = 0;
i < fragmentCount; ++
i) {
979 QRectF sourceRect(fragments[
i].sourceLeft, fragments[
i].sourceTop,
1009 for (
int i=0;
i<
path.elementCount(); ++
i) {
1023 p.cubicTo(
p1,
p2, p3);
1035 for (
int i=1;
i<
path.elementCount(); ++
i) {
1057 if (!
path.isEmpty()) {
1059 QPainter::RenderHints oldHints =
s->renderHints;
1060 bool changedHints =
false;
1066 changedHints =
true;
1072 s->renderHints = oldHints;
1088 static const int maxCachedGlyphSizeSquared = std::pow([]{
1095 return (pixelSize * pixelSize *
qAbs(
m.determinant())) <= maxCachedGlyphSizeSquared;
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
The QColor class provides colors based on RGB, HSV or CMYK values.
static int repetitionLimit()
QString path() const
Returns the file's path.
virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags)
StrokeHandler * strokeHandler
bool hasClipOperations() const
void replayClipOperations()
virtual void drawRects(const QRect *rects, int rectCount) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
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
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
virtual void drawEllipse(const QRectF &r) override
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor) override=0
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
virtual void drawLines(const QLine *lines, int lineCount) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
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
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
virtual QPainterState * createState(QPainterState *orig) const
virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override
Reimplement this function to draw the pixmap in the given rect, starting at the given p.
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
Reimplement this function to update the state of a paint engine.
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
Draws the first pointCount points in the buffer points.
virtual void drawPath(const QPainterPath &path) override
The default implementation ignores the path and does nothing.
virtual void drawStaticTextItem(QStaticTextItem *)
The QPaintEngineState class provides information about the active paint engine's current state....
PolygonDrawMode
\value OddEvenMode The polygon should be drawn using OddEven fill rule.
QPaintEngineState * state
ElementType
This enum describes the types of elements used to connect vertices in subpaths.
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.
void setCapStyle(Qt::PenCapStyle pcs)
Sets the pen's cap style to the given style.
qreal widthF() const
Returns the pen width with floating point precision.
void setStyle(Qt::PenStyle)
[0]
QList< qreal > dashPattern() const
Returns the dash pattern of this pen.
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
QColor color() const
Returns the color of this pen's brush.
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
void setColor(const QColor &color)
Sets the color of this pen's brush to the given color.
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
qreal miterLimit() const
Returns the miter limit of the pen.
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
qreal dashOffset() const
Returns the dash offset for the pen.
Qt::PenStyle style() const
Returns the pen style.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
QSizeF deviceIndependentSize() const
Returns the size of the pixmap in device independent pixels.
QRect rect() const
Returns the pixmap's enclosing rectangle.
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
constexpr void translate(qreal dx, qreal dy) noexcept
Moves the rectangle dx along the x-axis and dy along the y-axis, relative to the current position.
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
The QRegion class specifies a clip region for a painter.
int rectCount() const noexcept
const_iterator begin() const noexcept
QFontEngine * fontEngine() const
QFixedPoint * glyphPositions
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
Combined button and popup list for selecting options.
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
static ControlElement< T > * ptr(QWidget *widget)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
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
static void qpaintengineex_cubicTo(qreal c1x, qreal c1y, qreal c2x, qreal c2y, qreal ex, qreal ey, void *data)
Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale)
static const QPainterPath::ElementType qpaintengineex_roundedrect_types[]
static const QPainterPath::ElementType qpaintengineex_rect4_types_32[]
QDebug Q_GUI_EXPORT & operator<<(QDebug &s, const QVectorPath &path)
const QVectorPath & qtVectorPathForPath(const QPainterPath &path)
static const QPainterPath::ElementType qpaintengineex_line_types_16[]
static void qpaintengineex_lineTo(qreal x, qreal y, void *data)
#define QT_MAX_CACHED_GLYPH_SIZE
Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path)
static void qpaintengineex_moveTo(qreal x, qreal y, void *data)
static const QPainterPath::ElementType qpaintengineex_ellipse_types[]
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)
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
void(* qvectorpath_cache_cleanup)(QPaintEngineEx *engine, void *data)
QFileInfo info(fileName)
[8]
StrokeHandler(int reserve)
QDataBuffer< QPainterPath::ElementType > types