comparison layer/ColourMapper.cpp @ 1408:c8a6fd3f9dff fix-static-analysis

Use nullptr throughout
author Chris Cannam
date Mon, 26 Nov 2018 14:33:54 +0000
parents d79e21855aef
children
comparison
equal deleted inserted replaced
1407:05d614f6e46d 1408:c8a6fd3f9dff
109 static void 109 static void
110 mapDiscrete(double norm, vector<QColor> &colours, double &r, double &g, double &b) 110 mapDiscrete(double norm, vector<QColor> &colours, double &r, double &g, double &b)
111 { 111 {
112 int n = int(colours.size()); 112 int n = int(colours.size());
113 double m = norm * (n-1); 113 double m = norm * (n-1);
114 if (m >= n-1) { colours[n-1].getRgbF(&r, &g, &b, 0); return; } 114 if (m >= n-1) { colours[n-1].getRgbF(&r, &g, &b, nullptr); return; }
115 if (m <= 0) { colours[0].getRgbF(&r, &g, &b, 0); return; } 115 if (m <= 0) { colours[0].getRgbF(&r, &g, &b, nullptr); return; }
116 int base(int(floor(m))); 116 int base(int(floor(m)));
117 double prop0 = (base + 1.0) - m, prop1 = m - base; 117 double prop0 = (base + 1.0) - m, prop1 = m - base;
118 QColor c0(colours[base]), c1(colours[base+1]); 118 QColor c0(colours[base]), c1(colours[base+1]);
119 r = c0.redF() * prop0 + c1.redF() * prop1; 119 r = c0.redF() * prop0 + c1.redF() * prop1;
120 g = c0.greenF() * prop0 + c1.greenF() * prop1; 120 g = c0.greenF() * prop0 + c1.greenF() * prop1;