Clean-up QRgba64 constructors

We can add basic constructors now on all supported platforms, and can
make initialization consistent on all platforms, choosing undefined
as the default.

Note this changes behavior on gcc and clang builds, but is consistent
with pre-c++11 gcc and clang builds and with msvc.

[ChangeLog][QtGui][QRgba64] The default constructor on Clang and GCC
 builds now no longer initializes with 0s, but leaves the value
 uninitialized. This is consistent with MSVC behavior and pre-C++11
 behavior of GCC and Clang.

Change-Id: Ib0e3d7f4274a13a768db62931b67877e3898945e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
bb10
Allan Sandfeld Jensen 2017-02-28 09:51:26 +01:00
parent 8c0194f763
commit 13cfa3c88b
1 changed files with 1 additions and 13 deletions

View File

@ -64,26 +64,14 @@ class QRgba64 {
#endif
};
// No constructors are allowed in C++98, since this needs to be usable in a union.
// We however require one for constexprs in C++11/C++14
#ifdef Q_COMPILER_CONSTEXPR
explicit Q_ALWAYS_INLINE Q_DECL_CONSTEXPR QRgba64(quint64 c) : rgba(c) { }
#endif
public:
#ifdef Q_COMPILER_CONSTEXPR
Q_ALWAYS_INLINE Q_DECL_CONSTEXPR QRgba64() : rgba(0) { }
#endif
QRgba64() = default;
Q_DECL_CONSTEXPR static
QRgba64 fromRgba64(quint64 c)
{
#ifdef Q_COMPILER_CONSTEXPR
return QRgba64(c);
#else
QRgba64 rgba64;
rgba64.rgba = c;
return rgba64;
#endif
}
Q_DECL_CONSTEXPR static
QRgba64 fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha)