diff options
Diffstat (limited to 'src/gui/painting/qrgba64.h')
-rw-r--r-- | src/gui/painting/qrgba64.h | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h index 30d5e244b8..2c644c4cf0 100644 --- a/src/gui/painting/qrgba64.h +++ b/src/gui/painting/qrgba64.h @@ -64,16 +64,16 @@ class QRgba64 { #endif }; - explicit Q_ALWAYS_INLINE Q_DECL_CONSTEXPR QRgba64(quint64 c) : rgba(c) { } + explicit Q_ALWAYS_INLINE constexpr QRgba64(quint64 c) : rgba(c) { } public: QRgba64() = default; - Q_DECL_CONSTEXPR static + constexpr static QRgba64 fromRgba64(quint64 c) { return QRgba64(c); } - Q_DECL_CONSTEXPR static + constexpr static QRgba64 fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha) { return fromRgba64(quint64(red) << RedShift @@ -81,42 +81,42 @@ public: | quint64(blue) << BlueShift | quint64(alpha) << AlphaShift); } - Q_DECL_RELAXED_CONSTEXPR static QRgba64 fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha) + constexpr static QRgba64 fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha) { QRgba64 rgb64 = fromRgba64(red, green, blue, alpha); // Expand the range so that 0x00 maps to 0x0000 and 0xff maps to 0xffff. rgb64.rgba |= rgb64.rgba << 8; return rgb64; } - Q_DECL_RELAXED_CONSTEXPR static + constexpr static QRgba64 fromArgb32(uint rgb) { return fromRgba(quint8(rgb >> 16), quint8(rgb >> 8), quint8(rgb), quint8(rgb >> 24)); } - Q_DECL_CONSTEXPR bool isOpaque() const + constexpr bool isOpaque() const { return (rgba & alphaMask()) == alphaMask(); } - Q_DECL_CONSTEXPR bool isTransparent() const + constexpr bool isTransparent() const { return (rgba & alphaMask()) == 0; } - Q_DECL_CONSTEXPR quint16 red() const { return quint16(rgba >> RedShift); } - Q_DECL_CONSTEXPR quint16 green() const { return quint16(rgba >> GreenShift); } - Q_DECL_CONSTEXPR quint16 blue() const { return quint16(rgba >> BlueShift); } - Q_DECL_CONSTEXPR quint16 alpha() const { return quint16(rgba >> AlphaShift); } + constexpr quint16 red() const { return quint16(rgba >> RedShift); } + constexpr quint16 green() const { return quint16(rgba >> GreenShift); } + constexpr quint16 blue() const { return quint16(rgba >> BlueShift); } + constexpr quint16 alpha() const { return quint16(rgba >> AlphaShift); } void setRed(quint16 _red) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << RedShift)) | (quint64(_red) << RedShift); } void setGreen(quint16 _green) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << GreenShift)) | (quint64(_green) << GreenShift); } void setBlue(quint16 _blue) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << BlueShift)) | (quint64(_blue) << BlueShift); } void setAlpha(quint16 _alpha) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << AlphaShift)) | (quint64(_alpha) << AlphaShift); } - Q_DECL_CONSTEXPR quint8 red8() const { return div_257(red()); } - Q_DECL_CONSTEXPR quint8 green8() const { return div_257(green()); } - Q_DECL_CONSTEXPR quint8 blue8() const { return div_257(blue()); } - Q_DECL_CONSTEXPR quint8 alpha8() const { return div_257(alpha()); } - Q_DECL_CONSTEXPR uint toArgb32() const + constexpr quint8 red8() const { return div_257(red()); } + constexpr quint8 green8() const { return div_257(green()); } + constexpr quint8 blue8() const { return div_257(blue()); } + constexpr quint8 alpha8() const { return div_257(alpha()); } + constexpr uint toArgb32() const { #if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 quint64 br = rgba & Q_UINT64_C(0xffff0000ffff); @@ -140,12 +140,12 @@ public: return uint((alpha8() << 24) | (red8() << 16) | (green8() << 8) | blue8()); #endif } - Q_DECL_CONSTEXPR ushort toRgb16() const + constexpr ushort toRgb16() const { return ushort((red() & 0xf800) | ((green() >> 10) << 5) | (blue() >> 11)); } - Q_DECL_RELAXED_CONSTEXPR QRgba64 premultiplied() const + constexpr QRgba64 premultiplied() const { if (isOpaque()) return *this; @@ -167,7 +167,7 @@ public: #endif } - Q_DECL_RELAXED_CONSTEXPR QRgba64 unpremultiplied() const + constexpr QRgba64 unpremultiplied() const { #if Q_PROCESSOR_WORDSIZE < 8 return unpremultiplied_32bit(); @@ -176,7 +176,7 @@ public: #endif } - Q_DECL_CONSTEXPR operator quint64() const + constexpr operator quint64() const { return rgba; } @@ -188,11 +188,11 @@ public: } private: - static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint64 alphaMask() { return Q_UINT64_C(0xffff) << AlphaShift; } + static constexpr Q_ALWAYS_INLINE quint64 alphaMask() { return Q_UINT64_C(0xffff) << AlphaShift; } - static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint8 div_257_floor(uint x) { return quint8((x - (x >> 8)) >> 8); } - static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint8 div_257(quint16 x) { return div_257_floor(x + 128U); } - Q_DECL_RELAXED_CONSTEXPR Q_ALWAYS_INLINE QRgba64 unpremultiplied_32bit() const + static constexpr Q_ALWAYS_INLINE quint8 div_257_floor(uint x) { return quint8((x - (x >> 8)) >> 8); } + static constexpr Q_ALWAYS_INLINE quint8 div_257(quint16 x) { return div_257_floor(x + 128U); } + constexpr Q_ALWAYS_INLINE QRgba64 unpremultiplied_32bit() const { if (isOpaque() || isTransparent()) return *this; @@ -202,7 +202,7 @@ private: const quint16 b = quint16((blue() * 0xffff + a/2) / a); return fromRgba64(r, g, b, quint16(a)); } - Q_DECL_RELAXED_CONSTEXPR Q_ALWAYS_INLINE QRgba64 unpremultiplied_64bit() const + constexpr Q_ALWAYS_INLINE QRgba64 unpremultiplied_64bit() const { if (isOpaque() || isTransparent()) return *this; @@ -217,36 +217,36 @@ private: Q_DECLARE_TYPEINFO(QRgba64, Q_PRIMITIVE_TYPE); -Q_DECL_CONSTEXPR inline QRgba64 qRgba64(quint16 r, quint16 g, quint16 b, quint16 a) +constexpr inline QRgba64 qRgba64(quint16 r, quint16 g, quint16 b, quint16 a) { return QRgba64::fromRgba64(r, g, b, a); } -Q_DECL_CONSTEXPR inline QRgba64 qRgba64(quint64 c) +constexpr inline QRgba64 qRgba64(quint64 c) { return QRgba64::fromRgba64(c); } -Q_DECL_RELAXED_CONSTEXPR inline QRgba64 qPremultiply(QRgba64 c) +constexpr inline QRgba64 qPremultiply(QRgba64 c) { return c.premultiplied(); } -Q_DECL_RELAXED_CONSTEXPR inline QRgba64 qUnpremultiply(QRgba64 c) +constexpr inline QRgba64 qUnpremultiply(QRgba64 c) { return c.unpremultiplied(); } -inline Q_DECL_CONSTEXPR uint qRed(QRgba64 rgb) +inline constexpr uint qRed(QRgba64 rgb) { return rgb.red8(); } -inline Q_DECL_CONSTEXPR uint qGreen(QRgba64 rgb) +inline constexpr uint qGreen(QRgba64 rgb) { return rgb.green8(); } -inline Q_DECL_CONSTEXPR uint qBlue(QRgba64 rgb) +inline constexpr uint qBlue(QRgba64 rgb) { return rgb.blue8(); } -inline Q_DECL_CONSTEXPR uint qAlpha(QRgba64 rgb) +inline constexpr uint qAlpha(QRgba64 rgb) { return rgb.alpha8(); } QT_END_NAMESPACE |