Qt 4.8
Public Types | Public Functions | Public Variables | List of all members
QTessellatorPrivate::Vertices Struct Reference

Public Types

enum  { default_alloc = 128 }
 

Public Functions

void done ()
 
void init (int maxVertices)
 
Vertexnext (Vertex *v)
 
const Vertexnext (const Vertex *v) const
 
int nextPos (const Vertex *v) const
 
Vertexoperator[] (int i)
 
const Vertexoperator[] (int i) const
 
int position (const Vertex *v) const
 
Vertexprev (Vertex *v)
 
const Vertexprev (const Vertex *v) const
 
int prevPos (const Vertex *v) const
 
 Vertices ()
 
 ~Vertices ()
 

Public Variables

int allocated
 
int nPoints
 
Vertex ** sorted
 
Vertexstorage
 

Detailed Description

Definition at line 175 of file qtessellator.cpp.

Enumerations

◆ anonymous enum

anonymous enum
Enumerator
default_alloc 

Definition at line 176 of file qtessellator.cpp.

Constructors and Destructors

◆ Vertices()

QTessellatorPrivate::Vertices::Vertices ( )

Definition at line 549 of file qtessellator.cpp.

◆ ~Vertices()

QTessellatorPrivate::Vertices::~Vertices ( )

Definition at line 557 of file qtessellator.cpp.

558 {
559  if (storage) {
560  free(storage);
561  free(sorted);
562  }
563 }

Functions

◆ done()

void QTessellatorPrivate::Vertices::done ( )

Definition at line 575 of file qtessellator.cpp.

576 {
577  if (allocated > default_alloc) {
578  free(storage);
579  free(sorted);
580  storage = 0;
581  sorted = 0;
582  allocated = 0;
583  }
584 }

◆ init()

void QTessellatorPrivate::Vertices::init ( int  maxVertices)

Definition at line 565 of file qtessellator.cpp.

566 {
567  if (!storage || maxVertices > allocated) {
568  int size = qMax((int)default_alloc, maxVertices);
569  storage = q_check_ptr((Vertex *)realloc(storage, size*sizeof(Vertex)));
570  sorted = q_check_ptr((Vertex **)realloc(sorted, size*sizeof(Vertex *)));
571  allocated = maxVertices;
572  }
573 }
T * q_check_ptr(T *p)
Definition: qglobal.h:1857
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217

◆ next() [1/2]

Vertex* QTessellatorPrivate::Vertices::next ( Vertex v)
inline

◆ next() [2/2]

const Vertex* QTessellatorPrivate::Vertices::next ( const Vertex v) const
inline

Definition at line 195 of file qtessellator.cpp.

195  {
196  ++v;
197  if (v == storage + nPoints)
198  v = storage;
199  return v;
200  }

◆ nextPos()

int QTessellatorPrivate::Vertices::nextPos ( const Vertex v) const
inline

Definition at line 201 of file qtessellator.cpp.

Referenced by QTessellatorPrivate::addIntersection().

201  {
202  ++v;
203  if (v == storage + nPoints)
204  return 0;
205  return v - storage;
206  }

◆ operator[]() [1/2]

Vertex* QTessellatorPrivate::Vertices::operator[] ( int  i)
inline

Definition at line 184 of file qtessellator.cpp.

184 { return storage + i; }

◆ operator[]() [2/2]

const Vertex* QTessellatorPrivate::Vertices::operator[] ( int  i) const
inline

Definition at line 185 of file qtessellator.cpp.

185 { return storage + i; }

◆ position()

int QTessellatorPrivate::Vertices::position ( const Vertex v) const
inline

Definition at line 186 of file qtessellator.cpp.

Referenced by QTessellatorPrivate::addEdges(), and QTessellatorPrivate::removeEdges().

186  {
187  return v - storage;
188  }

◆ prev() [1/2]

Vertex* QTessellatorPrivate::Vertices::prev ( Vertex v)
inline

Definition at line 207 of file qtessellator.cpp.

Referenced by QTessellatorPrivate::cancelCoincidingEdges().

207  {
208  if (v == storage)
209  v = storage + nPoints;
210  --v;
211  return v;
212  }

◆ prev() [2/2]

const Vertex* QTessellatorPrivate::Vertices::prev ( const Vertex v) const
inline

Definition at line 213 of file qtessellator.cpp.

213  {
214  if (v == storage)
215  v = storage + nPoints;
216  --v;
217  return v;
218  }

◆ prevPos()

int QTessellatorPrivate::Vertices::prevPos ( const Vertex v) const
inline

Definition at line 219 of file qtessellator.cpp.

Referenced by QTessellatorPrivate::addEdges(), QTessellatorPrivate::addIntersection(), and QTessellatorPrivate::removeEdges().

219  {
220  if (v == storage)
221  v = storage + nPoints;
222  --v;
223  return v - storage;
224  }

Properties

◆ allocated

int QTessellatorPrivate::Vertices::allocated

Definition at line 226 of file qtessellator.cpp.

◆ nPoints

int QTessellatorPrivate::Vertices::nPoints

◆ sorted

Vertex** QTessellatorPrivate::Vertices::sorted

◆ storage

Vertex* QTessellatorPrivate::Vertices::storage

Definition at line 181 of file qtessellator.cpp.

Referenced by QTessellatorPrivate::collectAndSortVertices().


The documentation for this struct was generated from the following file: