About
Contact
QtCreator
KDevelop
Solarized
line #s on
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
#include
"qsgdefaultninepatchnode_p.h"
5
6
QT_BEGIN_NAMESPACE
7
8
QSGDefaultNinePatchNode
::
QSGDefaultNinePatchNode
()
9
:
m_geometry
(
QSGGeometry
::
defaultAttributes_TexturedPoint2D
(),
4
)
10
{
11
m_geometry
.
setDrawingMode
(
QSGGeometry
::
DrawTriangleStrip
);
12
setGeometry
(&
m_geometry
);
13
setMaterial
(&
m_material
);
14
}
15
16
QSGDefaultNinePatchNode
::
~QSGDefaultNinePatchNode
()
17
{
18
delete
m_material
.
texture
();
19
}
20
21
void
QSGDefaultNinePatchNode
::
setTexture
(
QSGTexture
*
texture
)
22
{
23
delete
m_material
.
texture
();
24
m_material
.
setTexture
(
texture
);
25
}
26
27
void
QSGDefaultNinePatchNode
::
setBounds
(
const
QRectF
&
bounds
)
28
{
29
m_bounds
=
bounds
;
30
}
31
32
void
QSGDefaultNinePatchNode
::
setDevicePixelRatio
(
qreal
ratio
)
33
{
34
m_devicePixelRatio
=
ratio
;
35
}
36
37
void
QSGDefaultNinePatchNode
::
setPadding
(
qreal
left
,
qreal
top
,
qreal
right
,
qreal
bottom
)
38
{
39
m_padding
=
QVector4D
(
left
,
top
,
right
,
bottom
);
40
}
41
42
void
QSGDefaultNinePatchNode
::
update
()
43
{
44
rebuildGeometry
(
texture:
m_material
.
texture
(),
geometry:
&
m_geometry
,
padding:
m_padding
,
bounds:
m_bounds
,
dpr:
m_devicePixelRatio
);
45
markDirty
(
bits:
QSGNode
::
DirtyGeometry
|
QSGNode
::
DirtyMaterial
);
46
}
47
48
QT_END_NAMESPACE
49
Definitions
QSGDefaultNinePatchNode
~QSGDefaultNinePatchNode
setTexture
setBounds
setDevicePixelRatio
setPadding
Start learning QML with our Intro Training
Find out more