Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qopengl2pexvertexarray_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists purely as an
9// implementation detail. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13//
14
15#ifndef QOPENGL2PEXVERTEXARRAY_P_H
16#define QOPENGL2PEXVERTEXARRAY_P_H
17
18#include <QRectF>
19
20#include <private/qdatabuffer_p.h>
21#include <private/qvectorpath_p.h>
22#include <private/qopenglcontext_p.h>
23
24QT_BEGIN_NAMESPACE
25
26class QOpenGLPoint
27{
28public:
29 QOpenGLPoint(GLfloat new_x, GLfloat new_y) :
30 x(new_x), y(new_y) {}
31
32 QOpenGLPoint(const QPointF &p) :
33 x(p.x()), y(p.y()) {}
34
35 QOpenGLPoint(const QPointF* p) :
36 x(p->x()), y(p->y()) {}
37
38 GLfloat x;
39 GLfloat y;
40
41 operator QPointF() {return QPointF(x,y);}
42 operator QPointF() const {return QPointF(x,y);}
43};
45
47{
48 QOpenGLRect(const QRectF &r)
49 : left(r.left()), top(r.top()), right(r.right()), bottom(r.bottom()) {}
50
51 QOpenGLRect(GLfloat l, GLfloat t, GLfloat r, GLfloat b)
52 : left(l), top(t), right(r), bottom(b) {}
53
58
60};
62
64{
65public:
68 maxX(-2e10), maxY(-2e10), minX(2e10), minY(2e10),
69 boundingRectDirty(true)
70 { }
71
72 inline void addRect(const QRectF &rect)
73 {
74 qreal top = rect.top();
75 qreal left = rect.left();
76 qreal bottom = rect.bottom();
77 qreal right = rect.right();
78
79 vertexArray << QOpenGLPoint(left, top)
80 << QOpenGLPoint(right, top)
81 << QOpenGLPoint(right, bottom)
82 << QOpenGLPoint(right, bottom)
83 << QOpenGLPoint(left, bottom)
84 << QOpenGLPoint(left, top);
85 }
86
87 inline void addQuad(const QRectF &rect)
88 {
89 qreal top = rect.top();
90 qreal left = rect.left();
91 qreal bottom = rect.bottom();
92 qreal right = rect.right();
93
94 vertexArray << QOpenGLPoint(left, top)
95 << QOpenGLPoint(right, top)
96 << QOpenGLPoint(left, bottom)
97 << QOpenGLPoint(right, bottom);
98
99 }
100
101 inline void addVertex(const GLfloat x, const GLfloat y)
102 {
103 vertexArray.add(QOpenGLPoint(x, y));
104 }
105
106 void addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline = true);
107 void clear();
108
109 QOpenGLPoint* data() {return vertexArray.data();}
110 int *stops() const { return vertexArrayStops.data(); }
111 int stopCount() const { return vertexArrayStops.size(); }
113
114 int vertexCount() const { return vertexArray.size(); }
115
116 void lineToArray(const GLfloat x, const GLfloat y);
117
118private:
119 QDataBuffer<QOpenGLPoint> vertexArray;
120 QDataBuffer<int> vertexArrayStops;
121
122 GLfloat maxX;
123 GLfloat maxY;
124 GLfloat minX;
125 GLfloat minY;
126 bool boundingRectDirty;
127 void addClosingLine(int index);
128 void addCentroid(const QVectorPath &path, int subPathIndex);
129};
130
131QT_END_NAMESPACE
132
133#endif
void addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline=true)
void addQuad(const QRectF &rect)
void addRect(const QRectF &rect)
void lineToArray(const GLfloat x, const GLfloat y)
void addVertex(const GLfloat x, const GLfloat y)
Combined button and popup list for selecting options.
Q_DECLARE_TYPEINFO(QOpenGLPoint, Q_PRIMITIVE_TYPE)
Q_DECLARE_TYPEINFO(QOpenGLRect, Q_PRIMITIVE_TYPE)
QOpenGLRect(GLfloat l, GLfloat t, GLfloat r, GLfloat b)
QOpenGLRect(const QRectF &r)