5#include "private/qpainterpath_p.h"
6#include "private/qrgba64_p.h"
12inline QString capString(
int caps)
25#if Q_PROCESSOR_WORDSIZE == 8
31#define toF26Dot6(x) static_cast<int>((x) * 64.)
40#if Q_PROCESSOR_WORDSIZE == 8
45 return x * (1<<16) /
y;
63 int delta = stop -
start;
65 pattern = stroker->reversePattern;
66 offset = stroker->patternLength - stroker->patternOffset - delta - ((
start & 63) - 32);
70 offset = stroker->patternOffset - ((
start & 63) - 32);
73 offset %= stroker->patternLength;
75 offset += stroker->patternLength;
78 while (dashIndex < stroker->patternSize - 1 &&
offset>=
pattern[dashIndex])
82 stroker->patternOffset += delta;
83 stroker->patternOffset %= stroker->patternLength;
87 return (dashIndex + dashOn) & 1;
93 dashIndex %= stroker->patternSize;
95 offset %= stroker->patternLength;
102 bool on()
const {
return true; }
103 void adjust(
int = 0) {}
113template<DrawPixel drawPixel,
class Dasher>
115template<DrawPixel drawPixel,
class Dasher>
175 switch (strokeSelection) {
207void QCosmeticStroker::setup()
215 int strokeSelection = 0;
227 if (penPattern.
isEmpty() || penPattern.
size() > 1024) {
234 pattern =
static_cast<int *
>(malloc(penPattern.
size() *
sizeof(
int)));
248 strokeSelection |=
Dashed;
413 bool swapped =
false;
422 int y = (
y1 + 32) >> 6;
423 int ys = (
y2 + 32) >> 6;
425 int round = (xinc > 0) ? 32 : 0;
427 x += ((
y * (1<<6)) + round -
y1) * xinc >> 6;
445 bool swapped =
false;
454 int x = (
x1 + 32) >> 6;
455 int xs = (
x2 + 32) >> 6;
457 int round = (yinc > 0) ? 32 : 0;
459 y += ((
x * (1<<6)) + round -
x1) * yinc >> 6;
523 calculateLastPoint(
p1.x(),
p1.y(),
p2.x(),
p2.y());
552 renderCubic(
p,
p2, p3, p4, caps);
559 Q_ASSERT(!
"QPainterPath::toSubpathPolygons(), bad element type");
583 calculateLastPoint(
p2.x(),
p2.y(),
p.x(),
p.y());
594 bool moveNextStart =
stroke(
this,
p.x(),
p.y(),
p2.x(),
p2.y(), caps);
609 if (
path.hasImplicitClose())
621 const int maxSubDivisions = 6;
634 int level = maxSubDivisions;
636 renderCubicSubdivision(
p,
level, caps);
641 const qreal half = .5;
649 c = (
c +
d ) * half;
659 c = (
c +
d ) * half;
708template<DrawPixel drawPixel,
class Dasher>
711 bool didDraw =
qAbs(rx2 - rx1) +
qAbs(ry2 - ry1) >= 1.0;
713 if (stroker->
clipLine(rx1, ry1, rx2, ry2))
732 bool swapped =
false;
748 int y = (
y1 + 32) >> 6;
749 int ys = (
y2 + 32) >> 6;
750 int round = (xinc > 0) ? 32 : 0;
758 x += ((
y * (1<<6)) + round -
y1) * xinc >> 6;
764 last.
x = (
x + (ys -
y - 1)*xinc) >> 16;
769 bool axisAligned =
qAbs(xinc) < (1 << 14);
799 last.
x = (
x + (ys -
y - 1)*xinc) >> 16;
805 Dasher dasher(stroker, swapped,
y * (1<<6), ys * (1<<6));
822 bool swapped =
false;
838 int x = (
x1 + 32) >> 6;
839 int xs = (
x2 + 32) >> 6;
840 int round = (yinc > 0) ? 32 : 0;
848 y += ((
x * (1<<6)) + round -
x1) * yinc >> 6;
855 last.
y = (
y + (xs -
x - 1)*yinc) >> 16;
859 bool axisAligned =
qAbs(yinc) < (1 << 14);
888 last.
y = (
y + (xs -
x - 1)*yinc) >> 16;
894 Dasher dasher(stroker, swapped,
x * (1<<6), xs * (1<<6));
910template<DrawPixel drawPixel,
class Dasher>
913 if (stroker->
clipLine(rx1, ry1, rx2, ry2))
929 bool swapped =
false;
938 x -= ( ((
y1 & 63) - 32) * xinc ) >> 6;
942 Dasher dasher(stroker, swapped,
y1,
y2);
947 int alphaStart, alphaEnd;
949 alphaStart =
y2 -
y1;
950 Q_ASSERT(alphaStart >= 0 && alphaStart < 64);
953 alphaStart = 64 - (
y1 & 63);
954 alphaEnd = (
y2 & 63);
980 if (alphaEnd && dasher.on()) {
992 bool swapped =
false;
1001 y -= ( ((
x1 & 63) - 32) * yinc ) >> 6;
1005 Dasher dasher(stroker, swapped,
x1,
x2);
1012 int alphaStart, alphaEnd;
1014 alphaStart =
x2 -
x1;
1015 Q_ASSERT(alphaStart >= 0 && alphaStart < 64);
1018 alphaStart = 64 - (
x1 & 63);
1019 alphaEnd = (
x2 & 63);
1044 if (alphaEnd && dasher.on()) {
QRgba64 rgba64() const noexcept
void drawPath(const QVectorPath &path)
QRasterPaintEngineState * state
bool clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)
void drawPoints(const QPoint *points, int num)
void drawLine(const QPointF &p1, const QPointF &p2)
@ Format_ARGB32_Premultiplied
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
QPainter::CompositionMode compositionMode() const
Returns the composition mode in the current paint engine state.
ElementType
This enum describes the types of elements used to connect vertices in subpaths.
QPainter::RenderHints renderHints
@ CompositionMode_SourceOver
qreal widthF() const
Returns the pen width with floating point precision.
QList< qreal > dashPattern() const
Returns the dash pattern of this pen.
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
qreal dashOffset() const
Returns the dash offset for the pen.
\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 bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
constexpr uint toArgb32() const
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
static const QPainterPath::ElementType * subPath(const QPainterPath::ElementType *t, const QPainterPath::ElementType *end, const qreal *points, bool *closed)
static bool drawLineAA(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps)
static StrokeLine strokeLine(int strokeSelection)
QT_BEGIN_NAMESPACE typedef int FDot16
void drawPixelARGB32Opaque(QCosmeticStroker *stroker, int x, int y, int)
static void capAdjust(int caps, int &x1, int &x2, FDot16 &y, FDot16 yinc)
static uint sourceOver(uint d, uint color)
void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage)
static int swapCaps(int caps)
void drawPixelARGB32(QCosmeticStroker *stroker, int x, int y, int coverage)
static bool drawLine(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps)
static FDot16 FDot16FixedDiv(int x, int y)
static void splitCubic(QCosmeticStroker::PointF *points)
void(* DrawPixel)(QCosmeticStroker *stroker, int x, int y, int coverage)
bool(* StrokeLine)(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
static uint BYTE_MUL(uint x, uint a)
static QRgba64 multiplyAlpha256(QRgba64 rgba64, uint alpha256)
bool qIsFinite(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr T qAbs(const T &t)
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
GLenum GLuint GLint level
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLuint GLfloat GLfloat GLfloat x1
GLenum GLuint GLintptr offset
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum const void * pixels
GLfixed GLfixed GLint GLint GLfixed points
GLfixed GLfixed GLfixed y2
GLsizei const GLchar *const * path
GLfloat GLfloat GLfloat alpha
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
constexpr int qAlpha(QRgb rgb)
QT_END_NAMESPACE typedef QT_PREPEND_NAMESPACE(quintptr) WId
QRasterBuffer * rasterBuffer
enum QSpanData::Type type
ProcessSpans unclipped_blend