From 08e24858607d1b1483fb1faa54effa957501cfbb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 18 Oct 2011 11:46:13 +0200 Subject: QSurfaceFormat: Use version in comparison and debug, fix setter. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id123ca9366b97a172e08a4608ccdffafb7caaf09 Reviewed-by: Samuel Rødal --- src/gui/kernel/qsurfaceformat.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 1919e2d282..6326033ff2 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -391,7 +391,10 @@ QSurfaceFormat::OpenGLContextProfile QSurfaceFormat::profile() const */ void QSurfaceFormat::setMajorVersion(int major) { - d->major = major; + if (d->major != major) { + detach(); + d->major = major; + } } /*! @@ -407,7 +410,10 @@ int QSurfaceFormat::majorVersion() const */ void QSurfaceFormat::setMinorVersion(int minor) { - d->minor = minor; + if (d->minor != minor) { + detach(); + d->minor = minor; + } } /*! @@ -429,10 +435,11 @@ bool operator==(const QSurfaceFormat& a, const QSurfaceFormat& b) && 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->profile == b.d->profile + && a.d->major == b.d->major + && a.d->minor == b.d->minor); } - /*! Returns false if all the options of the two QSurfaceFormat objects \a a and \a b are equal; otherwise returns true. @@ -451,7 +458,8 @@ QDebug operator<<(QDebug dbg, const QSurfaceFormat &f) const QSurfaceFormatPrivate * const d = f.d; dbg.nospace() << "QSurfaceFormat(" - << "options " << d->opts + << "version " << d->major << '.' << d->minor + << ", options " << d->opts << ", depthBufferSize " << d->depthSize << ", redBufferSize " << d->redBufferSize << ", greenBufferSize " << d->greenBufferSize -- cgit v1.2.3