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
qsgsoftwarepixmaptexture.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// Qt-Security score:significant reason:default
4
6#include <private/qsgcontext_p.h>
7
9
10QSGSoftwarePixmapTexture::QSGSoftwarePixmapTexture(const QImage &image, uint flags)
11{
12 // Prevent pixmap format conversion to reduce memory consumption
13 // and surprises in calling code. (See QTBUG-47328)
14 if (flags & QSGRenderContext::CreateTexture_Alpha) {
15 //If texture should have an alpha
16 m_pixmap = QPixmap::fromImage(image, Qt::NoFormatConversion);
17 } else {
18 //Force opaque texture
19 m_pixmap = QPixmap::fromImage(image.convertToFormat(QImage::Format_RGB32), Qt::NoFormatConversion);
20 }
21}
22
23QSGSoftwarePixmapTexture::QSGSoftwarePixmapTexture(const QPixmap &pixmap)
24 : m_pixmap(pixmap)
25{
26}
27
28QSize QSGSoftwarePixmapTexture::textureSize() const
29{
30 return m_pixmap.size();
31}
32
33bool QSGSoftwarePixmapTexture::hasAlphaChannel() const
34{
35 return m_pixmap.hasAlphaChannel();
36}
37
38bool QSGSoftwarePixmapTexture::hasMipmaps() const
39{
40 return false;
41}
42
43qint64 QSGSoftwarePixmapTexture::comparisonKey() const
44{
45 return 0;
46}
47
48QT_END_NAMESPACE
49
50#include "moc_qsgsoftwarepixmaptexture_p.cpp"
Combined button and popup list for selecting options.