Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
25
QT_BEGIN_NAMESPACE
26
27
class
QOpenGLPoint
28
{
29
public
:
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
};
45
Q_DECLARE_TYPEINFO
(QOpenGLPoint,
Q_PRIMITIVE_TYPE
);
46
47
struct
QOpenGLRect
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
55
GLfloat
left
;
56
GLfloat
top
;
57
GLfloat
right
;
58
GLfloat
bottom
;
59
60
operator
QRectF
()
const
{
return
QRectF
(
left
,
top
,
right
-
left
,
bottom
-
top
);}
61
};
62
Q_DECLARE_TYPEINFO
(
QOpenGLRect
,
Q_PRIMITIVE_TYPE
);
63
64
class
QOpenGL2PEXVertexArray
65
{
66
public
:
67
QOpenGL2PEXVertexArray
() :
68
vertexArray
(0),
vertexArrayStops
(0),
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(); }
113
QOpenGLRect
boundingRect
()
const
;
114
115
int
vertexCount
()
const
{
return
vertexArray.size(); }
116
117
void
lineToArray
(
const
GLfloat x,
const
GLfloat y);
118
119
private
:
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
132
QT_END_NAMESPACE
133
134
#
endif
QOpenGL2PEXVertexArray
Definition
qopengl2pexvertexarray_p.h:65
QOpenGL2PEXVertexArray::QOpenGL2PEXVertexArray
QOpenGL2PEXVertexArray()
Definition
qopengl2pexvertexarray_p.h:67
QOpenGL2PEXVertexArray::addPath
void addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline=true)
Definition
qopengl2pexvertexarray.cpp:51
QOpenGL2PEXVertexArray::addQuad
void addQuad(const QRectF &rect)
Definition
qopengl2pexvertexarray_p.h:88
QOpenGL2PEXVertexArray::addRect
void addRect(const QRectF &rect)
Definition
qopengl2pexvertexarray_p.h:73
QOpenGL2PEXVertexArray::lineToArray
void lineToArray(const GLfloat x, const GLfloat y)
Definition
qopengl2pexvertexarray.cpp:124
QOpenGL2PEXVertexArray::stopCount
int stopCount() const
Definition
qopengl2pexvertexarray_p.h:112
QOpenGL2PEXVertexArray::clear
void clear()
Definition
qopengl2pexvertexarray.cpp:11
QOpenGL2PEXVertexArray::vertexCount
int vertexCount() const
Definition
qopengl2pexvertexarray_p.h:115
QOpenGL2PEXVertexArray::boundingRect
QOpenGLRect boundingRect() const
Definition
qopengl2pexvertexarray.cpp:19
QOpenGL2PEXVertexArray::stops
int * stops() const
Definition
qopengl2pexvertexarray_p.h:111
QOpenGL2PEXVertexArray::addVertex
void addVertex(const GLfloat x, const GLfloat y)
Definition
qopengl2pexvertexarray_p.h:102
QOpenGL2PEXVertexArray::data
QOpenGLPoint * data()
Definition
qopengl2pexvertexarray_p.h:110
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(QOpenGLPoint, Q_PRIMITIVE_TYPE)
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(QOpenGLRect, Q_PRIMITIVE_TYPE)
QOpenGLRect
Definition
qopengl2pexvertexarray_p.h:48
QOpenGLRect::QOpenGLRect
QOpenGLRect(GLfloat l, GLfloat t, GLfloat r, GLfloat b)
Definition
qopengl2pexvertexarray_p.h:52
QOpenGLRect::right
GLfloat right
Definition
qopengl2pexvertexarray_p.h:57
QOpenGLRect::QOpenGLRect
QOpenGLRect(const QRectF &r)
Definition
qopengl2pexvertexarray_p.h:49
QOpenGLRect::bottom
GLfloat bottom
Definition
qopengl2pexvertexarray_p.h:58
QOpenGLRect::left
GLfloat left
Definition
qopengl2pexvertexarray_p.h:55
QOpenGLRect::top
GLfloat top
Definition
qopengl2pexvertexarray_p.h:56
qtbase
src
opengl
qopengl2pexvertexarray_p.h
Generated on
for Qt by
1.18.0