47 #define CURVE_FLATNESS Q_PI / 8 53 bool implicitClose,
bool endsAtStart)
57 }
else if (implicitClose) {
120 if (realWidth < 2.5 && (cosmetic ||
m_inv_scale == 1)) {
128 }
else if (cosmetic) {
146 const qreal *endPts = pts + (count<<1);
147 const qreal *startPts = 0;
153 while((pts + 2) < endPts && pts[0] == pts[2] && pts[1] == pts[3])
155 if ((pts + 2) == endPts)
160 bool endsAtStart = startPts[0] == *(endPts-2) && startPts[1] == *(endPts-1);
169 while (pts < endPts) {
170 if (
m_cx != pts[0] ||
m_cy != pts[1]) {
180 bool endsAtStart =
false;
181 while (pts < endPts) {
188 int end = (endPts - pts) / 2;
193 endsAtStart = startPts[0] == pts[i*2 - 2] && startPts[1] == pts[i*2 - 1];
264 while (front != end) {
295 qreal threshold_minus_1 = threshold - 1;
301 for (
int i=1; i<threshold; ++i) {
336 float xprod = prevNvx *
m_nvy - prevNvy *
m_nvx;
337 float px, py, qx, qy;
357 float pu = px * prevNvx + py * prevNvy;
358 float qv = qx * m_nvx + qy *
m_nvy;
359 float ix = (m_nvy * pu - prevNvy * qv) / xprod;
360 float iy = (prevNvx * qv - m_nvx * pu) / xprod;
383 for (
int i = points.
size() / 2; i > 0; --i)
387 for (
int i = 0; i < points.
size() / 2; ++i)
411 while (front != end) {
428 float dx1 = fromX - cx;
429 float dy1 = fromY - cy;
430 float dx2 = toX - cx;
431 float dy2 = toY - cy;
434 while (dx1 * dy2 - dx2 * dy1 < 0) {
436 float tmpy = dx1 * m_sin_theta + dy1 *
m_cos_theta;
444 while (dx1 * dx2 + dy1 * dy2 < 0) {
446 float tmpy = dx1 * m_sin_theta + dy1 *
m_cos_theta;
454 while (dx1 * dy2 - dx2 * dy1 > 0) {
456 float tmpy = dx1 * m_sin_theta + dy1 *
m_cos_theta;
484 : m_points(0), m_types(0),
516 float curvynessAdd, curvynessMul;
519 if (width < 2.5 && (cosmetic ||
m_inv_scale == 1)) {
522 }
else if (cosmetic) {
523 curvynessAdd= width / 2;
533 const qreal *endPts = pts + (count<<1);
540 while (pts < endPts) {
545 while (pts < endPts) {
560 *(((
const QPointF *) pts) + 1),
561 *(((
const QPointF *) pts) + 2));
564 int threshold = qMin<float>(64, (rad + curvynessAdd) * curvynessMul);
568 qreal threshold_minus_1 = threshold - 1;
569 for (
int i=0; i<threshold; ++i) {
ElementType
This enum describes the types of elements used to connect vertices in subpaths.
void setClipRect(const QRectF &clip)
#define QT_END_NAMESPACE
This macro expands to.
void lineTo(qfixed x, qfixed y)
void cubicTo(const qreal *pts)
void setDashOffset(qreal offset)
The QPointF class defines a point in the plane using floating point precision.
static void qdashprocessor_cubicTo(qreal, qreal, qreal, qreal, qreal, qreal, void *)
void process(const QVectorPath &path, const QPen &pen, const QRectF &clip)
Qt::PenJoinStyle qpen_joinStyle(const QPen &p)
QPointF pointAt(qreal t) const
Qt::PenCapStyle qpen_capStyle(const QPen &p)
void setDashPattern(const QVector< qfixed > &dashPattern)
static void qdashprocessor_moveTo(qreal x, qreal y, void *data)
The QPen class defines how a QPainter should draw lines and outlines of shapes.
const QPainterPath::ElementType * elements() const
void emitLineSegment(float x, float y, float nx, float ny)
QVector< qreal > dashPattern() const
Returns the dash pattern of this pen.
void setCubicToHook(qStrokerCubicToHook cubicToHook)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
qreal x() const
Returns the x-coordinate of this point.
void setMiterLimit(qreal limit)
virtual void end()
Finishes the stroke.
static QBezier fromPoints(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4)
QDataBuffer< QPainterPath::ElementType > m_types
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
void normalVector(float x1, float y1, float x2, float y2, float *nx, float *ny)
void endCapOrJoinClosed(const qreal *start, const qreal *cur, bool implicitClose, bool endsAtStart)
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
virtual void begin(void *data)
Prepares the stroker.
qreal height() const
Returns the height of the rectangle.
qreal qpen_widthf(const QPen &p)
static const char * data(const QByteArray &arr)
QDataBuffer< qreal > m_points
qreal width() const
Returns the width of the rectangle.
void process(const QVectorPath &path, const QPen &pen, const QRectF &clip)
QDataBuffer< float > m_vertices
static void qdashprocessor_lineTo(qreal x, qreal y, void *data)
qreal miterLimit() const
Returns the miter limit of the pen.
Qt::PenCapStyle m_cap_style
void join(const qreal *pts)
const qreal * points() const
void lineTo(const qreal *pts)
bool hasImplicitClose() const
void moveTo(const qreal *pts)
void arcPoints(float cx, float cy, float fromX, float fromY, float toX, float toY, QVarLengthArray< float > &points)
qreal y() const
Returns the y-coordinate of this point.
qreal dashOffset() const
Returns the dash offset for the pen.
Qt::PenJoinStyle m_join_style
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
void setLineToHook(qStrokerLineToHook lineToHook)
void endCap(const qreal *pts)
void moveTo(qfixed x, qfixed y)
void setMoveToHook(qStrokerMoveToHook moveToHook)
static const KeyPair *const end
QDashStroker m_dash_stroker
void setStrokeWidth(qreal width)