Qt 4.8
Classes | Public Types | Public Functions | Static Public Functions | Properties | List of all members
QVectorPath Class Reference

#include <qvectorpath_p.h>

Inheritance diagram for QVectorPath:
QRectVectorPath

Classes

struct  CacheEntry
 

Public Types

enum  Hint {
  AreaShapeMask = 0x0001, NonConvexShapeMask = 0x0002, CurvedShapeMask = 0x0004, LinesShapeMask = 0x0008,
  RectangleShapeMask = 0x0010, ShapeMask = 0x001f, LinesHint = LinesShapeMask, RectangleHint = AreaShapeMask | RectangleShapeMask,
  EllipseHint = AreaShapeMask | CurvedShapeMask, ConvexPolygonHint = AreaShapeMask, PolygonHint = AreaShapeMask | NonConvexShapeMask, RoundedRectHint = AreaShapeMask | CurvedShapeMask,
  ArbitraryShapeHint = AreaShapeMask | NonConvexShapeMask | CurvedShapeMask, IsCachedHint = 0x0100, ShouldUseCacheHint = 0x0200, ControlPointRect = 0x0400,
  OddEvenFill = 0x1000, WindingFill = 0x2000, ImplicitClose = 0x4000
}
 

Public Functions

CacheEntryaddCacheData (QPaintEngineEx *engine, void *data, qvectorpath_cache_cleanup cleanup) const
 
QRectF controlPointRect () const
 
const QPainterPath convertToPainterPath () const
 
int elementCount () const
 
const QPainterPath::ElementTypeelements () const
 
bool hasImplicitClose () const
 
bool hasWindingFill () const
 
uint hints () const
 
bool isCacheable () const
 
bool isConvex () const
 
bool isCurved () const
 
bool isEmpty () const
 
CacheEntrylookupCacheData (QPaintEngineEx *engine) const
 
void makeCacheable () const
 
const qrealpoints () const
 
 QVectorPath (const qreal *points, int count, const QPainterPath::ElementType *elements=0, uint hints=ArbitraryShapeHint)
 
Hint shape () const
 
 ~QVectorPath ()
 

Static Public Functions

static uint polygonFlags (QPaintEngine::PolygonDrawMode mode)
 

Properties

CacheEntrym_cache
 
const int m_count
 
QRealRect m_cp_rect
 
const QPainterPath::ElementTypem_elements
 
uint m_hints
 
const qrealm_points
 

Detailed Description

Definition at line 77 of file qvectorpath_p.h.

Enumerations

◆ Hint

Enumerator
AreaShapeMask 
NonConvexShapeMask 
CurvedShapeMask 
LinesShapeMask 
RectangleShapeMask 
ShapeMask 
LinesHint 
RectangleHint 
EllipseHint 
ConvexPolygonHint 
PolygonHint 
RoundedRectHint 
ArbitraryShapeHint 
IsCachedHint 
ShouldUseCacheHint 
ControlPointRect 
OddEvenFill 
WindingFill 
ImplicitClose 

Definition at line 80 of file qvectorpath_p.h.

80  {
81  // Shape hints, in 0x000000ff, access using shape()
82  AreaShapeMask = 0x0001, // shape covers an area
83  NonConvexShapeMask = 0x0002, // shape is not convex
84  CurvedShapeMask = 0x0004, // shape contains curves...
85  LinesShapeMask = 0x0008,
86  RectangleShapeMask = 0x0010,
87  ShapeMask = 0x001f,
88 
89  // Shape hints merged into basic shapes..
97 
98  // Other hints
99  IsCachedHint = 0x0100, // Set if the cache hint is set
100  ShouldUseCacheHint = 0x0200, // Set if the path should be cached when possible..
101  ControlPointRect = 0x0400, // Set if the control point rect has been calculated...
102 
103  // Shape rendering specifiers...
104  OddEvenFill = 0x1000,
105  WindingFill = 0x2000,
106  ImplicitClose = 0x4000
107  };

Constructors and Destructors

◆ QVectorPath()

QVectorPath::QVectorPath ( const qreal points,
int  count,
const QPainterPath::ElementType elements = 0,
uint  hints = ArbitraryShapeHint 
)
inline

Definition at line 110 of file qvectorpath_p.h.

114  : m_elements(elements),
115  m_points(points),
116  m_count(count),
117  m_hints(hints)
118  {
119  }
const int m_count
const QPainterPath::ElementType * elements() const
uint hints() const
const qreal * points() const
const QPainterPath::ElementType * m_elements
const qreal * m_points

◆ ~QVectorPath()

QVectorPath::~QVectorPath ( )

Definition at line 61 of file qpaintengineex.cpp.

62 {
64  CacheEntry *e = m_cache;
65  while (e) {
66  if (e->data)
67  e->cleanup(e->engine, e->data);
68  CacheEntry *n = e->next;
69  delete e;
70  e = n;
71  }
72  }
73 }
CacheEntry * m_cache
qvectorpath_cache_cleanup cleanup

Functions

◆ addCacheData()

QVectorPath::CacheEntry * QVectorPath::addCacheData ( QPaintEngineEx engine,
void *  data,
qvectorpath_cache_cleanup  cleanup 
) const

Definition at line 112 of file qpaintengineex.cpp.

113  {
114  Q_ASSERT(!lookupCacheData(engine));
115  if ((m_hints & IsCachedHint) == 0) {
116  m_cache = 0;
118  }
119  CacheEntry *e = new CacheEntry;
120  e->engine = engine;
121  e->data = data;
122  e->cleanup = cleanup;
123  e->next = m_cache;
124  m_cache = e;
125  return m_cache;
126 }
CacheEntry * m_cache
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
CacheEntry * lookupCacheData(QPaintEngineEx *engine) const
static const char * data(const QByteArray &arr)
static void cleanup()
Definition: qpicture.cpp:1508

◆ controlPointRect()

QRectF QVectorPath::controlPointRect ( ) const

Definition at line 76 of file qpaintengineex.cpp.

Referenced by QGL2PaintEngineEx::clip(), clipTransformIsSimple(), QEmulationPaintEngine::fill(), QRasterPaintEngine::fill(), QGL2PaintEngineExPrivate::fill(), operator<<(), QEmulationPaintEngine::stroke(), and QGL2PaintEngineExPrivate::stroke().

77 {
80 
81  if (m_count == 0) {
85  }
86  Q_ASSERT(m_points && m_count > 0);
87 
88  const qreal *pts = m_points;
89  m_cp_rect.x1 = m_cp_rect.x2 = *pts;
90  ++pts;
91  m_cp_rect.y1 = m_cp_rect.y2 = *pts;
92  ++pts;
93 
94  const qreal *epts = m_points + (m_count << 1);
95  while (pts < epts) {
96  qreal x = *pts;
97  if (x < m_cp_rect.x1) m_cp_rect.x1 = x;
98  else if (x > m_cp_rect.x2) m_cp_rect.x2 = x;
99  ++pts;
100 
101  qreal y = *pts;
102  if (y < m_cp_rect.y1) m_cp_rect.y1 = y;
103  else if (y > m_cp_rect.y2) m_cp_rect.y2 = y;
104  ++pts;
105  }
106 
109 }
const int m_count
double qreal
Definition: qglobal.h:1193
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QRealRect m_cp_rect
const qreal * m_points

◆ convertToPainterPath()

const QPainterPath QVectorPath::convertToPainterPath ( ) const
inline

Definition at line 199 of file qpainterpath_p.h.

Referenced by clipTransformIsSimple(), QDirectFBPaintEngine::fill(), QBlittablePixmapData::markRasterOverlay(), and QPaintEngineEx::stroke().

200 {
201  QPainterPath path;
202  path.ensureData();
203  QPainterPathData *data = path.d_func();
204  data->elements.reserve(m_count);
205  int index = 0;
206  data->elements[0].x = m_points[index++];
207  data->elements[0].y = m_points[index++];
208 
209  if (m_elements) {
210  data->elements[0].type = m_elements[0];
211  for (int i=1; i<m_count; ++i) {
212  QPainterPath::Element element;
213  element.x = m_points[index++];
214  element.y = m_points[index++];
215  element.type = m_elements[i];
216  data->elements << element;
217  }
218  } else {
219  data->elements[0].type = QPainterPath::MoveToElement;
220  for (int i=1; i<m_count; ++i) {
221  QPainterPath::Element element;
222  element.x = m_points[index++];
223  element.y = m_points[index++];
225  data->elements << element;
226  }
227  }
228 
229  if (m_hints & OddEvenFill)
230  data->fillRule = Qt::OddEvenFill;
231  else
232  data->fillRule = Qt::WindingFill;
233  return path;
234 }
ElementType type
the type of element
Definition: qpainterpath.h:81
The QPainterPath::Element class specifies the position and type of a subpath.
Definition: qpainterpath.h:77
const int m_count
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
qreal y
the y coordinate of the element&#39;s position.
Definition: qpainterpath.h:80
void ensureData()
Definition: qpainterpath.h:213
QPainterPathData * d_func() const
Definition: qpainterpath.h:221
static const char * data(const QByteArray &arr)
Qt::FillRule fillRule
qreal x
the x coordinate of the element&#39;s position.
Definition: qpainterpath.h:79
const QPainterPath::ElementType * m_elements
quint16 index
const qreal * m_points

◆ elementCount()

int QVectorPath::elementCount ( ) const
inline

◆ elements()

const QPainterPath::ElementType* QVectorPath::elements ( ) const
inline

◆ hasImplicitClose()

bool QVectorPath::hasImplicitClose ( ) const
inline

◆ hasWindingFill()

bool QVectorPath::hasWindingFill ( ) const
inline

◆ hints()

uint QVectorPath::hints ( ) const
inline

◆ isCacheable()

bool QVectorPath::isCacheable ( ) const
inline

◆ isConvex()

bool QVectorPath::isConvex ( ) const
inline

◆ isCurved()

bool QVectorPath::isCurved ( ) const
inline

Definition at line 127 of file qvectorpath_p.h.

Referenced by QGL2PaintEngineExPrivate::fill().

◆ isEmpty()

bool QVectorPath::isEmpty ( ) const
inline

◆ lookupCacheData()

CacheEntry* QVectorPath::lookupCacheData ( QPaintEngineEx engine) const
inline

Definition at line 153 of file qvectorpath_p.h.

Referenced by addCacheData(), and QGL2PaintEngineExPrivate::fill().

153  {
155  CacheEntry *e = m_cache;
156  while (e) {
157  if (e->engine == engine)
158  return e;
159  e = e->next;
160  }
161  return 0;
162  }
CacheEntry * m_cache
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ makeCacheable()

void QVectorPath::makeCacheable ( ) const
inline

◆ points()

const qreal* QVectorPath::points ( ) const
inline

◆ polygonFlags()

uint QVectorPath::polygonFlags ( QPaintEngine::PolygonDrawMode  mode)
inlinestatic

◆ shape()

Hint QVectorPath::shape ( ) const
inline

Properties

◆ m_cache

CacheEntry* QVectorPath::m_cache
mutableprivate

Definition at line 175 of file qvectorpath_p.h.

Referenced by addCacheData(), and ~QVectorPath().

◆ m_count

const int QVectorPath::m_count
private

Definition at line 170 of file qvectorpath_p.h.

Referenced by controlPointRect().

◆ m_cp_rect

QRealRect QVectorPath::m_cp_rect
mutableprivate

Definition at line 173 of file qvectorpath_p.h.

Referenced by controlPointRect().

◆ m_elements

const QPainterPath::ElementType* QVectorPath::m_elements
private

Definition at line 168 of file qvectorpath_p.h.

◆ m_hints

uint QVectorPath::m_hints
mutableprivate

Definition at line 172 of file qvectorpath_p.h.

Referenced by addCacheData(), controlPointRect(), and ~QVectorPath().

◆ m_points

const qreal* QVectorPath::m_points
private

Definition at line 169 of file qvectorpath_p.h.

Referenced by controlPointRect().


The documentation for this class was generated from the following files: