diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-02-28 09:51:26 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-03-13 10:46:29 +0000 |
commit | 13cfa3c88be220dbb732975bd76d19dfa70c4469 (patch) | |
tree | 54e112ce225ca7d6855a907605506dac5f065f51 | |
parent | 8c0194f76355c5a0341d276d09c2e49462082901 (diff) |
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>
-rw-r--r-- | src/gui/painting/qrgba64.h | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h index a3ae0c9b14..2c8f8fa8c4 100644 --- a/src/gui/painting/qrgba64.h +++ b/src/gui/painting/qrgba64.h @@ -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) |