4 #include "PaintEngine.h" 5 #include "qpainterpath.h" 15 typedef void(*qvectorpath_cache_cleanup)(
CPaintEngine *engine,
void *data);
22 AreaShapeMask = 0x0001,
23 NonConvexShapeMask = 0x0002,
24 CurvedShapeMask = 0x0004,
25 LinesShapeMask = 0x0008,
26 RectangleShapeMask = 0x0010,
30 LinesHint = LinesShapeMask,
31 RectangleHint = AreaShapeMask | RectangleShapeMask,
32 EllipseHint = AreaShapeMask | CurvedShapeMask,
33 ConvexPolygonHint = AreaShapeMask,
34 PolygonHint = AreaShapeMask | NonConvexShapeMask,
35 RoundedRectHint = AreaShapeMask | CurvedShapeMask,
36 ArbitraryShapeHint = AreaShapeMask | NonConvexShapeMask | CurvedShapeMask,
39 IsCachedHint = 0x0100,
40 ShouldUseCacheHint = 0x0200,
41 ControlPointRect = 0x0400,
46 ImplicitClose = 0x4000
49 QVectorPath(
const float *points,
int count,
const QPainterPath::ElementType *elements = 0, uint32 hints = ArbitraryShapeHint);
52 QRectF controlPointRect()
const;
54 inline Hint shape()
const {
return (Hint)(m_hints & ShapeMask); }
55 inline bool isConvex()
const {
return (m_hints & NonConvexShapeMask) == 0; }
56 inline bool isCurved()
const {
return (m_hints & CurvedShapeMask)!=0; }
58 inline bool isCacheable()
const {
return (m_hints & ShouldUseCacheHint) != 0; }
59 inline bool hasImplicitClose()
const {
return (m_hints & ImplicitClose) != 0; }
60 inline bool hasWindingFill()
const {
return (m_hints & WindingFill) != 0; }
62 inline void makeCacheable()
const { m_hints |= ShouldUseCacheHint; m_cache = 0; }
63 inline uint32 hints()
const {
return m_hints; }
65 inline const QPainterPath::ElementType *elements()
const {
return m_elements; }
66 inline const float *points()
const {
return m_points; }
67 inline bool isEmpty()
const {
return m_points == 0; }
69 inline int elementCount()
const {
return m_count; }
72 static inline uint32 polygonFlags(CPaintEngine::PolygonDrawMode mode)
75 case CPaintEngine::ConvexMode:
return ConvexPolygonHint | ImplicitClose;
76 case CPaintEngine::OddEvenMode:
return PolygonHint | OddEvenFill | ImplicitClose;
77 case CPaintEngine::WindingMode:
return PolygonHint | WindingFill | ImplicitClose;
78 case CPaintEngine::PolylineMode:
return PolygonHint;
86 qvectorpath_cache_cleanup cleanup;
92 PE_ASSERT(m_hints & ShouldUseCacheHint);
95 if (e->engine == engine)
102 template <
typename T>
static inline bool isRect(
const T *pts,
int elementCount) {
103 return (elementCount == 5
104 && pts[0] == pts[8] && pts[1] == pts[9]
105 && pts[0] == pts[6] && pts[2] == pts[4]
106 && pts[1] == pts[3] && pts[5] == pts[7]
107 && pts[0] < pts[4] && pts[1] < pts[5]
110 && pts[0] == pts[6] && pts[2] == pts[4]
111 && pts[1] == pts[3] && pts[5] == pts[7]
112 && pts[0] < pts[4] && pts[1] < pts[5]
116 inline bool isRect()
const 118 const QPainterPath::ElementType *
const types = elements();
120 return (shape() == QVectorPath::RectangleHint)
121 || (isRect(points(), elementCount())
122 && (!types || (types[0] == QPainterPath::MoveToElement
123 && types[1] == QPainterPath::LineToElement
124 && types[2] == QPainterPath::LineToElement
125 && types[3] == QPainterPath::LineToElement)));
130 const QPainterPath::ElementType *m_elements;
131 const float *m_points;
134 mutable uint32 m_hints;
different physics engine has different winding order.
Definition: EventBinding.h:32
Definition: ParaRect.h:517
Definition: qvectorpath.h:11
Definition: qvectorpath.h:83
The CPaintEngine class provides an abstract definition of how CPainter draws to a given device on a g...
Definition: PaintEngine.h:34
Definition: qvectorpath.h:17
Definition: qpainterpath.h:18