summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qsurfaceformat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qsurfaceformat.cpp')
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp102
1 files changed, 40 insertions, 62 deletions
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index 366e68ebe3..74add6e973 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qsurfaceformat.h"
@@ -152,6 +116,9 @@ public:
the monitoring of the loss of context, such as, Windows with WGL, or Linux/X11 (xcb) with GLX, will
monitor the status in every call to \l{QOpenGLContext::makeCurrent()}{makeCurrent()}. See
\l{QOpenGLContext::isValid()}{isValid()} for more information on this.
+ \value ProtectedContent Enables access to protected content. This allows the GPU to operate on protected
+ resources (surfaces, buffers, textures), for example DRM-protected video content.
+ Currently only implemented for EGL.
*/
/*!
@@ -351,6 +318,9 @@ void QSurfaceFormat::setSamples(int numSamples)
Sets the format options to \a options.
+ To verify that an option was respected, compare the actual format to the
+ requested format after surface/context creation.
+
\sa options(), testOption()
*/
void QSurfaceFormat::setOptions(QSurfaceFormat::FormatOptions options)
@@ -366,6 +336,9 @@ void QSurfaceFormat::setOptions(QSurfaceFormat::FormatOptions options)
Sets the format option \a option if \a on is true; otherwise, clears the option.
+ To verify that an option was respected, compare the actual format to the
+ requested format after surface/context creation.
+
\sa setOptions(), options(), testOption()
*/
void QSurfaceFormat::setOption(QSurfaceFormat::FormatOption option, bool on)
@@ -744,8 +717,10 @@ void QSurfaceFormat::setColorSpace(const QColorSpace &colorSpace)
}
}
+#if QT_DEPRECATED_SINCE(6, 0)
/*!
\overload
+ \deprecated [6.0] Use setColorSpace(QColorSpace) instead.
Sets the colorspace to one of the predefined values.
@@ -764,6 +739,7 @@ void QSurfaceFormat::setColorSpace(ColorSpace colorSpace)
break;
}
}
+#endif // QT_DEPRECATED_SINCE(6, 0)
/*!
\return the color space.
@@ -789,7 +765,7 @@ Q_GLOBAL_STATIC(QSurfaceFormat, qt_default_surface_format)
question's own setFormat() function. However, it is often more convenient to
set the format for all windows once at the start of the application. It also
guarantees proper behavior in cases where shared contexts are required,
- because settings the format via this function guarantees that all contexts
+ because setting the format via this function guarantees that all contexts
and surfaces, even the ones created internally by Qt, will use the same
format.
@@ -831,37 +807,37 @@ QSurfaceFormat QSurfaceFormat::defaultFormat()
}
/*!
- Returns \c true if all the options of the two QSurfaceFormat objects
- \a a and \a b are equal.
+ \fn bool QSurfaceFormat::operator==(const QSurfaceFormat& lhs, const QSurfaceFormat& rhs)
- \relates QSurfaceFormat
+ Returns \c true if all the options of the two QSurfaceFormat objects
+ \a lhs and \a rhs are equal.
*/
-bool operator==(const QSurfaceFormat& a, const QSurfaceFormat& b)
-{
- return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts
- && a.d->stencilSize == b.d->stencilSize
- && a.d->redBufferSize == b.d->redBufferSize
- && a.d->greenBufferSize == b.d->greenBufferSize
- && a.d->blueBufferSize == b.d->blueBufferSize
- && a.d->alphaBufferSize == b.d->alphaBufferSize
- && a.d->depthSize == b.d->depthSize
- && a.d->numSamples == b.d->numSamples
- && a.d->swapBehavior == b.d->swapBehavior
- && a.d->profile == b.d->profile
- && a.d->major == b.d->major
- && a.d->minor == b.d->minor
- && a.d->swapInterval == b.d->swapInterval);
-}
/*!
+ \fn bool QSurfaceFormat::operator!=(const QSurfaceFormat& lhs, const QSurfaceFormat& rhs)
+
Returns \c false if all the options of the two QSurfaceFormat objects
- \a a and \a b are equal; otherwise returns \c true.
+ \a lhs and \a rhs are equal; otherwise returns \c true.
+*/
- \relates QSurfaceFormat
+/*!
+ \internal
*/
-bool operator!=(const QSurfaceFormat& a, const QSurfaceFormat& b)
+bool QSurfaceFormat::equals(const QSurfaceFormat& other) const noexcept
{
- return !(a == b);
+ return (d == other.d) || ((int) d->opts == (int) other.d->opts
+ && d->stencilSize == other.d->stencilSize
+ && d->redBufferSize == other.d->redBufferSize
+ && d->greenBufferSize == other.d->greenBufferSize
+ && d->blueBufferSize == other.d->blueBufferSize
+ && d->alphaBufferSize == other.d->alphaBufferSize
+ && d->depthSize == other.d->depthSize
+ && d->numSamples == other.d->numSamples
+ && d->swapBehavior == other.d->swapBehavior
+ && d->profile == other.d->profile
+ && d->major == other.d->major
+ && d->minor == other.d->minor
+ && d->swapInterval == other.d->swapInterval);
}
#ifndef QT_NO_DEBUG_STREAM
@@ -891,3 +867,5 @@ QDebug operator<<(QDebug dbg, const QSurfaceFormat &f)
#endif
QT_END_NAMESPACE
+
+#include "moc_qsurfaceformat.cpp"