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// Qt-Security score:significant reason:default
15
16#ifndef QOPENGL2PEXVERTEXARRAY_P_H
17#define QOPENGL2PEXVERTEXARRAY_P_H
18
19#include <QRectF>
20
21#include <private/qdatabuffer_p.h>
22#include <private/qvectorpath_p.h>
23#include <private/qopenglcontext_p.h>
24
25QT_BEGIN_NAMESPACE
26
27class QOpenGLPoint
28{
29public:
30 QOpenGLPoint(GLfloat new_x, GLfloat new_y) :
31 x(new_x), y(new_y) {}
32
33 QOpenGLPoint(const QPointF &p) :
34 x(p.x()), y(p.y()) {}
35
36 QOpenGLPoint(const QPointF* p) :
37 x(p->x()), y(p->y()) {}
38
39 GLfloat x;
40 GLfloat y;
41
42 operator QPointF() {return QPointF(x,y);}
43 operator QPointF() const {return QPointF(x,y);}
44};
46
48{
49 QOpenGLRect(const QRectF &r)
50 : left(r.left()), top(r.top()), right(r.right()), bottom(r.bottom()) {}
51
52 QOpenGLRect(GLfloat l, GLfloat t, GLfloat r, GLfloat b)
53 : left(l), top(t), right(r), bottom(b) {}
54
59
61};
63
65{
66public:
69 maxX(-2e10), maxY(-2e10), minX(2e10), minY(2e10),
70 boundingRectDirty(true)
71 { }
72
73 inline void addRect(const QRectF &rect)
74 {
75 qreal top = rect.top();
76 qreal left = rect.left();
77 qreal bottom = rect.bottom();
78 qreal right = rect.right();
79
80 vertexArray << QOpenGLPoint(left, top)
81 << QOpenGLPoint(right, top)
82 << QOpenGLPoint(right, bottom)
83 << QOpenGLPoint(right, bottom)
84 << QOpenGLPoint(left, bottom)
85 << QOpenGLPoint(left, top);
86 }
87
88 inline void addQuad(const QRectF &rect)
89 {
90 qreal top = rect.top();
91 qreal left = rect.left();
92 qreal bottom = rect.bottom();
93 qreal right = rect.right();
94
95 vertexArray << QOpenGLPoint(left, top)
96 << QOpenGLPoint(right, top)
97 << QOpenGLPoint(left, bottom)
98 << QOpenGLPoint(right, bottom);
99
100 }
101
102 inline void addVertex(const GLfloat x, const GLfloat y)
103 {
104 vertexArray.add(QOpenGLPoint(x, y));
105 }
106
107 void addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline = true);
108 void clear();
109
110 QOpenGLPoint* data() {return vertexArray.data();}
111 int *stops() const { return vertexArrayStops.data(); }
112 int stopCount() const { return vertexArrayStops.size(); }
114
115 int vertexCount() const { return vertexArray.size(); }
116
117 void lineToArray(const GLfloat x, const GLfloat y);
118
119private:
120 QDataBuffer<QOpenGLPoint> vertexArray;
121 QDataBuffer<int> vertexArrayStops;
122
123 GLfloat maxX;
124 GLfloat maxY;
125 GLfloat minX;
126 GLfloat minY;
127 bool boundingRectDirty;
128 void addClosingLine(int index);
129 void addCentroid(const QVectorPath &path, int subPathIndex);
130};
131
132QT_END_NAMESPACE
133
134#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)