aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-09-15 09:36:45 +1000
committerNeil <nyamatongwe@gmail.com>2021-09-15 09:36:45 +1000
commitd4a5d7d6955982496ba523a439fc98276a28e2d8 (patch)
treef9cd5e2a57e247dc59f47404cfea8469cc74b35c /win32/PlatWin.cxx
parentda71ace9e135d3494fafa7d67483ff1c217faa04 (diff)
downloadscintilla-mirror-d4a5d7d6955982496ba523a439fc98276a28e2d8.tar.gz
Move colour mixing implementations into implementation file.
Avoids some warnings but drops constexpr. Use MixedWith in PlatWin for GDI instead of local implementation. Add unit tests for Geometry.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r--win32/PlatWin.cxx14
1 files changed, 1 insertions, 13 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 3e966b4d3..c4f08b798 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -865,18 +865,6 @@ void DIBSection::SetSymmetric(LONG x, LONG y, DWORD value) noexcept {
SetPixel(xSymmetric, ySymmetric, value);
}
-constexpr unsigned int Proportional(unsigned char a, unsigned char b, XYPOSITION t) noexcept {
- return static_cast<unsigned int>(a + t * (b - a));
-}
-
-ColourRGBA Proportional(ColourRGBA a, ColourRGBA b, XYPOSITION t) noexcept {
- return ColourRGBA(
- Proportional(a.GetRed(), b.GetRed(), t),
- Proportional(a.GetGreen(), b.GetGreen(), t),
- Proportional(a.GetBlue(), b.GetBlue(), t),
- Proportional(a.GetAlpha(), b.GetAlpha(), t));
-}
-
ColourRGBA GradientValue(const std::vector<ColourStop> &stops, XYPOSITION proportion) noexcept {
for (size_t stop = 0; stop < stops.size() - 1; stop++) {
// Loop through each pair of stops
@@ -885,7 +873,7 @@ ColourRGBA GradientValue(const std::vector<ColourStop> &stops, XYPOSITION propor
if ((proportion >= positionStart) && (proportion <= positionEnd)) {
const XYPOSITION proportionInPair = (proportion - positionStart) /
(positionEnd - positionStart);
- return Proportional(stops[stop].colour, stops[stop + 1].colour, proportionInPair);
+ return stops[stop].colour.MixedWith(stops[stop + 1].colour, proportionInPair);
}
}
// Loop should always find a value