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
qsgopenvgtexture.cpp
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
#
include
"qsgopenvgtexture.h"
5
#
include
"qsgopenvghelpers.h"
6
7
QT_BEGIN_NAMESPACE
8
9
QSGOpenVGTexture::QSGOpenVGTexture(
const
QImage &image, uint flags)
10
{
11
Q_UNUSED(flags);
12
13
VGImageFormat format = QSGOpenVGHelpers::qImageFormatToVGImageFormat(image.format());
14
m_image = vgCreateImage(format, image.width(), image.height(), VG_IMAGE_QUALITY_BETTER);
15
16
// Do Texture Upload
17
vgImageSubData(m_image, image.constBits(), image.bytesPerLine(), format, 0, 0, image.width(), image.height());
18
}
19
20
QSGOpenVGTexture
::~
QSGOpenVGTexture
()
21
{
22
vgDestroyImage(m_image);
23
}
24
25
qint64
QSGOpenVGTexture
::
comparisonKey
()
const
26
{
27
return
qint64(
static_cast
<
int
>(m_image));
28
}
29
30
QSize
QSGOpenVGTexture
::
textureSize
()
const
31
{
32
VGint imageWidth = vgGetParameteri(m_image, VG_IMAGE_WIDTH);
33
VGint imageHeight = vgGetParameteri(m_image, VG_IMAGE_HEIGHT);
34
return
QSize(imageWidth, imageHeight);
35
}
36
37
bool
QSGOpenVGTexture
::
hasAlphaChannel
()
const
38
{
39
VGImageFormat format =
static_cast
<VGImageFormat>(vgGetParameteri(m_image, VG_IMAGE_FORMAT));
40
41
switch
(format) {
42
case
VG_sRGBA_8888:
43
case
VG_sRGBA_8888_PRE:
44
case
VG_sRGBA_5551:
45
case
VG_sRGBA_4444:
46
case
VG_lRGBA_8888:
47
case
VG_lRGBA_8888_PRE:
48
case
VG_A_8:
49
case
VG_A_1:
50
case
VG_A_4:
51
case
VG_sARGB_8888:
52
case
VG_sARGB_8888_PRE:
53
case
VG_sARGB_1555:
54
case
VG_sARGB_4444:
55
case
VG_lARGB_8888:
56
case
VG_lARGB_8888_PRE:
57
case
VG_sBGRA_8888:
58
case
VG_sBGRA_8888_PRE:
59
case
VG_sBGRA_5551:
60
case
VG_sBGRA_4444:
61
case
VG_lBGRA_8888:
62
case
VG_lBGRA_8888_PRE:
63
case
VG_sABGR_8888:
64
case
VG_sABGR_8888_PRE:
65
case
VG_sABGR_1555:
66
case
VG_sABGR_4444:
67
case
VG_lABGR_8888:
68
case
VG_lABGR_8888_PRE:
69
return
true
;
70
break
;
71
default
:
72
break
;
73
}
74
return
false
;
75
}
76
77
bool
QSGOpenVGTexture
::
hasMipmaps
()
const
78
{
79
return
false
;
80
}
81
82
QT_END_NAMESPACE
QSGOpenVGTexture
Definition
qsgopenvgtexture.h:14
QSGOpenVGTexture::textureSize
QSize textureSize() const override
Returns the size of the texture in pixels.
Definition
qsgopenvgtexture.cpp:30
QSGOpenVGTexture::hasMipmaps
bool hasMipmaps() const override
Returns true if the texture data contains mipmap levels.
Definition
qsgopenvgtexture.cpp:77
QSGOpenVGTexture::hasAlphaChannel
bool hasAlphaChannel() const override
Returns true if the texture data contains an alpha channel.
Definition
qsgopenvgtexture.cpp:37
QSGOpenVGTexture::comparisonKey
qint64 comparisonKey() const override
Returns a key suitable for comparing textures.
Definition
qsgopenvgtexture.cpp:25
QSGOpenVGTexture::~QSGOpenVGTexture
~QSGOpenVGTexture()
Definition
qsgopenvgtexture.cpp:20
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtdeclarative
src
plugins
scenegraph
openvg
qsgopenvgtexture.cpp
Generated on
for Qt by
1.18.0