Qt 4.8
Public Functions | Private Functions | Properties | List of all members
QGLRectMaskGenerator Class Reference
Inheritance diagram for QGLRectMaskGenerator:
QGLTrapezoidMaskGenerator QGLMaskGenerator

Public Functions

 QGLRectMaskGenerator (const QPainterPath &path, const QTransform &matrix, QGLOffscreen &offscreen, GLuint maskFragmentProgram)
 
- Public Functions inherited from QGLTrapezoidMaskGenerator
void drawMask (const QRect &rect)
 
 QGLTrapezoidMaskGenerator (const QPainterPath &path, const QTransform &matrix, QGLOffscreen &offscreen, GLuint maskFragmentProgram, qreal strokeWidth=-1.0)
 
QRect screenRect ()
 
- Public Functions inherited from QGLMaskGenerator
QTransform matrix () const
 
QPainterPath path () const
 
 QGLMaskGenerator (const QPainterPath &path, const QTransform &matrix, qreal stroke_width=-1)
 
qreal strokeWidth () const
 
virtual ~QGLMaskGenerator ()
 

Private Functions

QRect computeScreenRect ()
 
QVector< QGLTrapezoidgenerateTrapezoids ()
 

Properties

QPainterPath transformedPath
 

Detailed Description

Definition at line 3076 of file qpaintengine_opengl.cpp.

Constructors and Destructors

◆ QGLRectMaskGenerator()

QGLRectMaskGenerator::QGLRectMaskGenerator ( const QPainterPath path,
const QTransform matrix,
QGLOffscreen offscreen,
GLuint  maskFragmentProgram 
)

Definition at line 3205 of file qpaintengine_opengl.cpp.

3206  : QGLTrapezoidMaskGenerator(path, matrix, offs, program)
3207 {
3208 }
QGLTrapezoidMaskGenerator(const QPainterPath &path, const QTransform &matrix, QGLOffscreen &offscreen, GLuint maskFragmentProgram, qreal strokeWidth=-1.0)

Functions

◆ computeScreenRect()

QRect QGLRectMaskGenerator::computeScreenRect ( )
privatevirtual

Implements QGLTrapezoidMaskGenerator.

Definition at line 3215 of file qpaintengine_opengl.cpp.

3216 {
3217  transformedPath = matrix().map(path());
3218 
3219  return transformedPath.controlPointRect().adjusted(-1, -1, 1, 1).toAlignedRect();
3220 }
QRect toAlignedRect() const
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle...
Definition: qrect.cpp:2817
QPoint map(const QPoint &p) const
Creates and returns a QPoint object that is a copy of the given point, mapped into the coordinate sys...
QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:781
QRectF controlPointRect() const
Returns the rectangle containing all the points and control points in this path.
QTransform matrix() const
QPainterPath path() const

◆ generateTrapezoids()

QVector< QGLTrapezoid > QGLRectMaskGenerator::generateTrapezoids ( )
privatevirtual

Implements QGLTrapezoidMaskGenerator.

Definition at line 3247 of file qpaintengine_opengl.cpp.

3248 {
3250 
3251  QOpenGLImmediateModeTessellator tessellator;
3252  if (matrix().type() <= QTransform::TxScale) {
3257 
3258  QPointF first = (a + d) * 0.5;
3259  QPointF last = (b + c) * 0.5;
3260 
3261  QPointF delta = a - d;
3262 
3263  // manhattan distance (no rotation)
3264  qreal width = qAbs(delta.x()) + qAbs(delta.y());
3265 
3266  Q_ASSERT(qFuzzyIsNull(delta.x()) || qFuzzyIsNull(delta.y()));
3267 
3268  tessellator.tessellateRect(first, last, width);
3269  } else {
3270  QPointF points[5];
3271 
3272  for (int i = 0; i < 5; ++i)
3273  points[i] = transformedPath.elementAt(i);
3274 
3275  tessellator.tessellateConvex(points, 5);
3276  }
3277  return tessellator.trapezoids;
3278 }
double d
Definition: qnumeric_p.h:62
double qreal
Definition: qglobal.h:1193
unsigned char c[8]
Definition: qnumeric_p.h:62
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
long ASN1_INTEGER_get ASN1_INTEGER * a
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
TransformationType type() const
Returns the transformation type of this matrix.
const QPainterPath::Element & elementAt(int i) const
Returns the element at the given index in the painter path.
Definition: qpainterpath.h:402
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
QTransform matrix() const
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
Definition: qglobal.h:2043
int elementCount() const
Returns the number of path elements in the painter path.
Definition: qpainterpath.h:397

Properties

◆ transformedPath

QPainterPath QGLRectMaskGenerator::transformedPath
private

Definition at line 3085 of file qpaintengine_opengl.cpp.


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