Qt 4.8
Macros | Typedefs | Enumerations | Functions
qcosmeticstroker.cpp File Reference
#include "qcosmeticstroker_p.h"
#include "private/qpainterpath_p.h"
#include <qdebug.h>
#include <math.h>

Go to the source code of this file.

Macros

#define toF26Dot6(x)   ((int)((x)*64.))
 

Typedefs

typedef void(* DrawPixel) (QCosmeticStroker *stroker, int x, int y, int coverage)
 

Enumerations

enum  StrokeSelection {
  Aliased = 0, AntiAliased = 1, Solid = 0, Dashed = 2,
  RegularDraw = 0, FastDraw = 4
}
 

Functions

static void capAdjust (int caps, int &x1, int &x2, int &y, int yinc)
 
template<DrawPixel drawPixel, class Dasher >
static bool drawLine (QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps)
 
template<DrawPixel drawPixel, class Dasher >
static bool drawLineAA (QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps)
 
void drawPixel (QCosmeticStroker *stroker, int x, int y, int coverage)
 
void drawPixelARGB32 (QCosmeticStroker *stroker, int x, int y, int coverage)
 
void drawPixelARGB32Opaque (QCosmeticStroker *stroker, int x, int y, int)
 
static int F16Dot16FixedDiv (int x, int y)
 
static uint sourceOver (uint d, uint color)
 
static void splitCubic (QCosmeticStroker::PointF *points)
 
static StrokeLine strokeLine (int strokeSelection)
 
static const QPainterPath::ElementTypesubPath (const QPainterPath::ElementType *t, const QPainterPath::ElementType *end, const qreal *points, bool *closed)
 
static int swapCaps (int caps)
 

Macro Definition Documentation

◆ toF26Dot6

#define toF26Dot6 (   x)    ((int)((x)*64.))

Definition at line 63 of file qcosmeticstroker.cpp.

Referenced by QCosmeticStroker::calculateLastPoint(), drawLine(), and drawLineAA().

Typedef Documentation

◆ DrawPixel

typedef void(* DrawPixel) (QCosmeticStroker *stroker, int x, int y, int coverage)

Definition at line 77 of file qcosmeticstroker.cpp.

Enumeration Type Documentation

◆ StrokeSelection

Enumerator
Aliased 
AntiAliased 
Solid 
Dashed 
RegularDraw 
FastDraw 

Definition at line 188 of file qcosmeticstroker.cpp.

188  {
189  Aliased = 0,
190  AntiAliased = 1,
191  Solid = 0,
192  Dashed = 2,
193  RegularDraw = 0,
194  FastDraw = 4
195 };

Function Documentation

◆ capAdjust()

static void capAdjust ( int  caps,
int &  x1,
int &  x2,
int &  y,
int  yinc 
)
inlinestatic

Definition at line 718 of file qcosmeticstroker.cpp.

Referenced by drawLine(), and drawLineAA().

719 {
720  if (caps & QCosmeticStroker::CapBegin) {
721  x1 -= 32;
722  y -= yinc >> 1;
723  }
724  if (caps & QCosmeticStroker::CapEnd) {
725  x2 += 32;
726  }
727 }

◆ drawLine()

template<DrawPixel drawPixel, class Dasher >
static bool drawLine ( QCosmeticStroker stroker,
qreal  x1,
qreal  y1,
qreal  x2,
qreal  y2,
int  caps 
)
static

Definition at line 734 of file qcosmeticstroker.cpp.

Referenced by QPainter::drawLine().

735 {
736  if (stroker->clipLine(rx1, ry1, rx2, ry2))
737  return false;
738 
739  static const int half = 31;
740  int x1 = toF26Dot6(rx1) + half;
741  int y1 = toF26Dot6(ry1) + half;
742  int x2 = toF26Dot6(rx2) + half;
743  int y2 = toF26Dot6(ry2) + half;
744 
745  int dx = qAbs(x2 - x1);
746  int dy = qAbs(y2 - y1);
747 
748  QCosmeticStroker::Point last = stroker->lastPixel;
749 
750 // qDebug() << "stroke" << x1/64. << y1/64. << x2/64. << y2/64.;
751 
752  if (dx < dy) {
753  // vertical
755 
756  bool swapped = false;
757  if (y1 > y2) {
758  swapped = true;
759  qSwap(y1, y2);
760  qSwap(x1, x2);
761  caps = swapCaps(caps);
763  }
764  int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1);
765  int x = x1 << 10;
766 
767  if ((stroker->lastDir ^ QCosmeticStroker::VerticalMask) == dir)
769 
770  capAdjust(caps, y1, y2, x, xinc);
771 
772  int y = (y1 + 32) >> 6;
773  int ys = (y2 + 32) >> 6;
774 
775  if (y != ys) {
776  x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6;
777 
778  // calculate first and last pixel and perform dropout control
780  first.x = x >> 16;
781  first.y = y;
782  last.x = (x + (ys - y - 1)*xinc) >> 16;
783  last.y = ys - 1;
784  if (swapped)
785  qSwap(first, last);
786 
787  bool axisAligned = qAbs(xinc) < (1 << 14);
788  if (stroker->lastPixel.x >= 0) {
789  if (first.x == stroker->lastPixel.x &&
790  first.y == stroker->lastPixel.y) {
791  // remove duplicated pixel
792  if (swapped) {
793  --ys;
794  } else {
795  ++y;
796  x += xinc;
797  }
798  } else if (stroker->lastDir != dir &&
799  (((axisAligned && stroker->lastAxisAligned) &&
800  stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) ||
801  (qAbs(stroker->lastPixel.x - first.x) > 1 ||
802  qAbs(stroker->lastPixel.y - first.y) > 1))) {
803  // have a missing pixel, insert it
804  if (swapped) {
805  ++ys;
806  } else {
807  --y;
808  x -= xinc;
809  }
810  }
811  }
812  stroker->lastDir = dir;
813  stroker->lastAxisAligned = axisAligned;
814 
815  Dasher dasher(stroker, swapped, y << 6, ys << 6);
816 
817  do {
818  if (dasher.on())
819  drawPixel(stroker, x >> 16, y, 255);
820  dasher.adjust();
821  x += xinc;
822  } while (++y < ys);
823  }
824  } else {
825  // horizontal
826  if (!dx)
827  return true;
828 
830 
831  bool swapped = false;
832  if (x1 > x2) {
833  swapped = true;
834  qSwap(x1, x2);
835  qSwap(y1, y2);
836  caps = swapCaps(caps);
838  }
839  int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1);
840  int y = y1 << 10;
841 
842  if ((stroker->lastDir ^ QCosmeticStroker::HorizontalMask) == dir)
844 
845  capAdjust(caps, x1, x2, y, yinc);
846 
847  int x = (x1 + 32) >> 6;
848  int xs = (x2 + 32) >> 6;
849 
850  if (x != xs) {
851  y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6;
852 
853  // calculate first and last pixel to perform dropout control
855  first.x = x;
856  first.y = y >> 16;
857  last.x = xs - 1;
858  last.y = (y + (xs - x - 1)*yinc) >> 16;
859  if (swapped)
860  qSwap(first, last);
861 
862  bool axisAligned = qAbs(yinc) < (1 << 14);
863  if (stroker->lastPixel.x >= 0) {
864  if (first.x == stroker->lastPixel.x && first.y == stroker->lastPixel.y) {
865  // remove duplicated pixel
866  if (swapped) {
867  --xs;
868  } else {
869  ++x;
870  y += yinc;
871  }
872  } else if (stroker->lastDir != dir &&
873  (((axisAligned && stroker->lastAxisAligned) &&
874  stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) ||
875  (qAbs(stroker->lastPixel.x - first.x) > 1 ||
876  qAbs(stroker->lastPixel.y - first.y) > 1))) {
877  // have a missing pixel, insert it
878  if (swapped) {
879  ++xs;
880  } else {
881  --x;
882  y -= yinc;
883  }
884  }
885  }
886  stroker->lastDir = dir;
887  stroker->lastAxisAligned = axisAligned;
888 
889  Dasher dasher(stroker, swapped, x << 6, xs << 6);
890 
891  do {
892  if (dasher.on())
893  drawPixel(stroker, x, y >> 16, 255);
894  dasher.adjust();
895  y += yinc;
896  } while (++x < xs);
897  }
898  }
899  stroker->lastPixel = last;
900  return true;
901 }
#define toF26Dot6(x)
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
static int F16Dot16FixedDiv(int x, int y)
static void capAdjust(int caps, int &x1, int &x2, int &y, int yinc)
void qSwap(T &value1, T &value2)
Definition: qglobal.h:2181
static int swapCaps(int caps)
void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage)
bool clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)

◆ drawLineAA()

template<DrawPixel drawPixel, class Dasher >
static bool drawLineAA ( QCosmeticStroker stroker,
qreal  x1,
qreal  y1,
qreal  x2,
qreal  y2,
int  caps 
)
static

Definition at line 905 of file qcosmeticstroker.cpp.

906 {
907  if (stroker->clipLine(rx1, ry1, rx2, ry2))
908  return false;
909 
910  int x1 = toF26Dot6(rx1);
911  int y1 = toF26Dot6(ry1);
912  int x2 = toF26Dot6(rx2);
913  int y2 = toF26Dot6(ry2);
914 
915  int dx = x2 - x1;
916  int dy = y2 - y1;
917 
918  if (qAbs(dx) < qAbs(dy)) {
919  // vertical
920 
921  int xinc = F16Dot16FixedDiv(dx, dy);
922 
923  bool swapped = false;
924  if (y1 > y2) {
925  qSwap(y1, y2);
926  qSwap(x1, x2);
927  swapped = true;
928  caps = swapCaps(caps);
929  }
930 
931  int x = (x1 - 32) << 10;
932  x -= ( ((y1 & 63) - 32) * xinc ) >> 6;
933 
934  capAdjust(caps, y1, y2, x, xinc);
935 
936  Dasher dasher(stroker, swapped, y1, y2);
937 
938  int y = y1 >> 6;
939  int ys = y2 >> 6;
940 
941  int alphaStart, alphaEnd;
942  if (y == ys) {
943  alphaStart = y2 - y1;
944  Q_ASSERT(alphaStart >= 0 && alphaStart < 64);
945  alphaEnd = 0;
946  } else {
947  alphaStart = 64 - (y1 & 63);
948  alphaEnd = (y2 & 63);
949  }
950 // qDebug() << "vertical" << x1/64. << y1/64. << x2/64. << y2/64.;
951 // qDebug() << " x=" << x << "dx=" << dx << "xi=" << (x>>16) << "xsi=" << ((x+(ys-y)*dx)>>16) << "y=" << y << "ys=" << ys;
952 
953  // draw first pixel
954  if (dasher.on()) {
955  uint alpha = (quint8)(x >> 8);
956  drawPixel(stroker, x>>16, y, (255-alpha) * alphaStart >> 6);
957  drawPixel(stroker, (x>>16) + 1, y, alpha * alphaStart >> 6);
958  }
959  dasher.adjust();
960  x += xinc;
961  ++y;
962  if (y < ys) {
963  do {
964  if (dasher.on()) {
965  uint alpha = (quint8)(x >> 8);
966  drawPixel(stroker, x>>16, y, (255-alpha));
967  drawPixel(stroker, (x>>16) + 1, y, alpha);
968  }
969  dasher.adjust();
970  x += xinc;
971  } while (++y < ys);
972  }
973  // draw last pixel
974  if (alphaEnd && dasher.on()) {
975  uint alpha = (quint8)(x >> 8);
976  drawPixel(stroker, x>>16, y, (255-alpha) * alphaEnd >> 6);
977  drawPixel(stroker, (x>>16) + 1, y, alpha * alphaEnd >> 6);
978  }
979  } else {
980  // horizontal
981  if (!dx)
982  return true;
983 
984  int yinc = F16Dot16FixedDiv(dy, dx);
985 
986  bool swapped = false;
987  if (x1 > x2) {
988  qSwap(x1, x2);
989  qSwap(y1, y2);
990  swapped = true;
991  caps = swapCaps(caps);
992  }
993 
994  int y = (y1 - 32) << 10;
995  y -= ( ((x1 & 63) - 32) * yinc ) >> 6;
996 
997  capAdjust(caps, x1, x2, y, yinc);
998 
999  Dasher dasher(stroker, swapped, x1, x2);
1000 
1001  int x = x1 >> 6;
1002  int xs = x2 >> 6;
1003 
1004 // qDebug() << "horizontal" << x1/64. << y1/64. << x2/64. << y2/64.;
1005 // qDebug() << " y=" << y << "dy=" << dy << "x=" << x << "xs=" << xs << "yi=" << (y>>16) << "ysi=" << ((y+(xs-x)*dy)>>16);
1006  int alphaStart, alphaEnd;
1007  if (x == xs) {
1008  alphaStart = x2 - x1;
1009  Q_ASSERT(alphaStart >= 0 && alphaStart < 64);
1010  alphaEnd = 0;
1011  } else {
1012  alphaStart = 64 - (x1 & 63);
1013  alphaEnd = (x2 & 63);
1014  }
1015 
1016  // draw first pixel
1017  if (dasher.on()) {
1018  uint alpha = (quint8)(y >> 8);
1019  drawPixel(stroker, x, y>>16, (255-alpha) * alphaStart >> 6);
1020  drawPixel(stroker, x, (y>>16) + 1, alpha * alphaStart >> 6);
1021  }
1022  dasher.adjust();
1023  y += yinc;
1024  ++x;
1025  // draw line
1026  if (x < xs) {
1027  do {
1028  if (dasher.on()) {
1029  uint alpha = (quint8)(y >> 8);
1030  drawPixel(stroker, x, y>>16, (255-alpha));
1031  drawPixel(stroker, x, (y>>16) + 1, alpha);
1032  }
1033  dasher.adjust();
1034  y += yinc;
1035  } while (++x < xs);
1036  }
1037  // draw last pixel
1038  if (alphaEnd && dasher.on()) {
1039  uint alpha = (quint8)(y >> 8);
1040  drawPixel(stroker, x, y>>16, (255-alpha) * alphaEnd >> 6);
1041  drawPixel(stroker, x, (y>>16) + 1, alpha * alphaEnd >> 6);
1042  }
1043  }
1044  return true;
1045 }
#define toF26Dot6(x)
unsigned char quint8
Definition: qglobal.h:934
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static int F16Dot16FixedDiv(int x, int y)
static void capAdjust(int caps, int &x1, int &x2, int &y, int yinc)
unsigned int uint
Definition: qglobal.h:996
void qSwap(T &value1, T &value2)
Definition: qglobal.h:2181
static int swapCaps(int caps)
void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage)
bool clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)

◆ drawPixel()

void drawPixel ( QCosmeticStroker stroker,
int  x,
int  y,
int  coverage 
)
inline

Definition at line 146 of file qcosmeticstroker.cpp.

Referenced by drawLine(), drawLineAA(), QCosmeticStroker::drawPoints(), and strokeLine().

147 {
148  const QRect &cl = stroker->clip;
149  if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom())
150  return;
151 
152  int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ;
153  int lasty = stroker->spans[stroker->current_span-1].y;
154 
155  if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) {
156  stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData);
157  stroker->current_span = 0;
158  }
159 
160  stroker->spans[stroker->current_span].x = ushort(x);
161  stroker->spans[stroker->current_span].len = 1;
162  stroker->spans[stroker->current_span].y = y;
163  stroker->spans[stroker->current_span].coverage = coverage*stroker->opacity >> 8;
164  ++stroker->current_span;
165 }
unsigned char coverage
unsigned short len
QT_FT_Span spans[NSPANS]
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
unsigned short ushort
Definition: qglobal.h:995
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QRasterPaintEngineState * state

◆ drawPixelARGB32()

void drawPixelARGB32 ( QCosmeticStroker stroker,
int  x,
int  y,
int  coverage 
)
inline

Definition at line 167 of file qcosmeticstroker.cpp.

Referenced by strokeLine().

168 {
169  const QRect &cl = stroker->clip;
170  if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom())
171  return;
172 
173  int offset = x + stroker->ppl*y;
174  uint c = BYTE_MUL(stroker->color, coverage);
175  stroker->pixels[offset] = sourceOver(stroker->pixels[offset], c);
176 }
unsigned char c[8]
Definition: qnumeric_p.h:62
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a)
unsigned int uint
Definition: qglobal.h:996
static uint sourceOver(uint d, uint color)
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

◆ drawPixelARGB32Opaque()

void drawPixelARGB32Opaque ( QCosmeticStroker stroker,
int  x,
int  y,
int   
)
inline

Definition at line 178 of file qcosmeticstroker.cpp.

Referenced by strokeLine().

179 {
180  const QRect &cl = stroker->clip;
181  if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom())
182  return;
183 
184  int offset = x + stroker->ppl*y;
185  stroker->pixels[offset] = sourceOver(stroker->pixels[offset], stroker->color);
186 }
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
static uint sourceOver(uint d, uint color)
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

◆ F16Dot16FixedDiv()

static int F16Dot16FixedDiv ( int  x,
int  y 
)
inlinestatic

Definition at line 70 of file qcosmeticstroker.cpp.

Referenced by QCosmeticStroker::calculateLastPoint(), drawLine(), and drawLineAA().

71 {
72  if (qAbs(x) > 0x7fff)
73  return (((qlonglong)x) << 16) / y;
74  return (x << 16) / y;
75 }
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
qint64 qlonglong
Definition: qglobal.h:951

◆ sourceOver()

static uint sourceOver ( uint  d,
uint  color 
)
inlinestatic

Definition at line 65 of file qcosmeticstroker.cpp.

Referenced by drawPixelARGB32(), and drawPixelARGB32Opaque().

66 {
67  return color + BYTE_MUL(d, qAlpha(~color));
68 }
double d
Definition: qnumeric_p.h:62
int qAlpha(QRgb rgba)
Returns the alpha component of the ARGB quadruplet rgba.
Definition: qrgb.h:66
Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a)

◆ splitCubic()

static void splitCubic ( QCosmeticStroker::PointF points)
static

Definition at line 664 of file qcosmeticstroker.cpp.

Referenced by QCosmeticStroker::renderCubicSubdivision().

665 {
666  const qreal half = .5;
667  qreal a, b, c, d;
668 
669  points[6].x = points[3].x;
670  c = points[1].x;
671  d = points[2].x;
672  points[1].x = a = ( points[0].x + c ) * half;
673  points[5].x = b = ( points[3].x + d ) * half;
674  c = ( c + d ) * half;
675  points[2].x = a = ( a + c ) * half;
676  points[4].x = b = ( b + c ) * half;
677  points[3].x = ( a + b ) * half;
678 
679  points[6].y = points[3].y;
680  c = points[1].y;
681  d = points[2].y;
682  points[1].y = a = ( points[0].y + c ) * half;
683  points[5].y = b = ( points[3].y + d ) * half;
684  c = ( c + d ) * half;
685  points[2].y = a = ( a + c ) * half;
686  points[4].y = b = ( b + c ) * half;
687  points[3].y = ( a + b ) * half;
688 }
double d
Definition: qnumeric_p.h:62
double qreal
Definition: qglobal.h:1193
unsigned char c[8]
Definition: qnumeric_p.h:62
long ASN1_INTEGER_get ASN1_INTEGER * a

◆ strokeLine()

static StrokeLine strokeLine ( int  strokeSelection)
static

Definition at line 197 of file qcosmeticstroker.cpp.

Referenced by QCosmeticStroker::setup().

198 {
199  StrokeLine stroke;
200 
201  switch (strokeSelection) {
203  stroke = &QT_PREPEND_NAMESPACE(drawLine)<drawPixel, NoDasher>;
204  break;
205  case Aliased|Solid|FastDraw:
207  break;
209  stroke = &QT_PREPEND_NAMESPACE(drawLine)<drawPixel, Dasher>;
210  break;
211  case Aliased|Dashed|FastDraw:
213  break;
215  stroke = &QT_PREPEND_NAMESPACE(drawLineAA)<drawPixel, NoDasher>;
216  break;
218  stroke = &QT_PREPEND_NAMESPACE(drawLineAA)<drawPixelARGB32, NoDasher>;
219  break;
221  stroke = &QT_PREPEND_NAMESPACE(drawLineAA)<drawPixel, Dasher>;
222  break;
224  stroke = &QT_PREPEND_NAMESPACE(drawLineAA)<drawPixelARGB32, Dasher>;
225  break;
226  default:
227  Q_ASSERT(false);
228  stroke = 0;
229  }
230  return stroke;
231 }
static bool drawLineAA(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps)
void drawPixelARGB32(QCosmeticStroker *stroker, int x, int y, int coverage)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define QT_PREPEND_NAMESPACE(name)
This macro qualifies identifier with the full namespace.
Definition: qglobal.h:87
bool(* StrokeLine)(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps)
void drawPixelARGB32Opaque(QCosmeticStroker *stroker, int x, int y, int)
static bool drawLine(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps)
void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage)

◆ subPath()

static const QPainterPath::ElementType* subPath ( const QPainterPath::ElementType t,
const QPainterPath::ElementType end,
const qreal points,
bool *  closed 
)
inlinestatic

Definition at line 498 of file qcosmeticstroker.cpp.

Referenced by QCosmeticStroker::drawPath().

500 {
501  const QPainterPath::ElementType *start = t;
502  ++t;
503 
504  // find out if the subpath is closed
505  while (t < end) {
506  if (*t == QPainterPath::MoveToElement)
507  break;
508  ++t;
509  }
510 
511  int offset = t - start - 1;
512 // qDebug() << "subpath" << offset << points[0] << points[1] << points[2*offset] << points[2*offset+1];
513  *closed = (points[0] == points[2*offset] && points[1] == points[2*offset + 1]);
514 
515  return t;
516 }
ElementType
This enum describes the types of elements used to connect vertices in subpaths.
Definition: qpainterpath.h:70
static const KeyPair *const end

◆ swapCaps()

static int swapCaps ( int  caps)
inlinestatic

Definition at line 711 of file qcosmeticstroker.cpp.

Referenced by drawLine(), and drawLineAA().