summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2023-09-15 10:17:01 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-09-20 19:20:13 +0000
commitbaac34de6fcbdcc6ee5eb06c3db16c7eda32f121 (patch)
tree2e74e3ea65a33a245c6461bdffb7e5f8eac38a9c /src/gui/painting
parent8ffb6ce64cb0183bf6805497b398463549c1ed8d (diff)
Switch QRgbaFloat api to hardcoded float parameter and return values
This makes it source compatible with Qt 6.5 by allowing us to change FastType to something other than float, which we have done for Qt 6.6 on systems with AVX float16 instructions. Pick-to: 6.6 6.6.0 Change-Id: I7ebf0c178ba0ff7f04f6788d182a1a000fe31c0c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qrgbafloat.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/gui/painting/qrgbafloat.h b/src/gui/painting/qrgbafloat.h
index 160623eb1e..da74328f71 100644
--- a/src/gui/painting/qrgbafloat.h
+++ b/src/gui/painting/qrgbafloat.h
@@ -61,19 +61,19 @@ public:
constexpr bool isOpaque() const { return a >= FastType(1.0f); }
constexpr bool isTransparent() const { return a <= FastType(0.0f); }
- constexpr FastType red() const { return r; }
- constexpr FastType green() const { return g; }
- constexpr FastType blue() const { return b; }
- constexpr FastType alpha() const { return a; }
- void setRed(FastType _red) { r = F(_red); }
- void setGreen(FastType _green) { g = F(_green); }
- void setBlue(FastType _blue) { b = F(_blue); }
- void setAlpha(FastType _alpha) { a = F(_alpha); }
-
- constexpr FastType redNormalized() const { return clamp01(r); }
- constexpr FastType greenNormalized() const { return clamp01(g); }
- constexpr FastType blueNormalized() const { return clamp01(b); }
- constexpr FastType alphaNormalized() const { return clamp01(a); }
+ constexpr float red() const { return r; }
+ constexpr float green() const { return g; }
+ constexpr float blue() const { return b; }
+ constexpr float alpha() const { return a; }
+ void setRed(float _red) { r = F(_red); }
+ void setGreen(float _green) { g = F(_green); }
+ void setBlue(float _blue) { b = F(_blue); }
+ void setAlpha(float _alpha) { a = F(_alpha); }
+
+ constexpr float redNormalized() const { return clamp01(r); }
+ constexpr float greenNormalized() const { return clamp01(g); }
+ constexpr float blueNormalized() const { return clamp01(b); }
+ constexpr float alphaNormalized() const { return clamp01(a); }
constexpr quint8 red8() const { return qRound(redNormalized() * FastType(255.0f)); }
constexpr quint8 green8() const { return qRound(greenNormalized() * FastType(255.0f)); }