Fixed crashes and random colored dots after code cleanup

on behalf of Lebedev, see issue 1332
This commit is contained in:
Oliver Duis
2012-06-12 17:45:12 +02:00
parent 6b30bb2f47
commit eaf1ea086d
2 changed files with 7 additions and 4 deletions

View File

@@ -29,18 +29,18 @@ namespace rtengine {
template<typename _Tp>
inline const _Tp& LIM(const _Tp& a, const _Tp& b, const _Tp& c) {
inline const _Tp LIM(const _Tp& a, const _Tp& b, const _Tp& c) {
return std::max(b,std::min(a,c));
}
template<typename _Tp>
inline const _Tp& ULIM(const _Tp& a, const _Tp& b, const _Tp& c) {
inline const _Tp ULIM(const _Tp& a, const _Tp& b, const _Tp& c) {
return ((b < c) ? LIM(a,b,c) : LIM(a,c,b));
}
template<typename _Tp>
inline const _Tp& CLIP(const _Tp& a) {
return LIM(a, static_cast<typeof(a)>(0), static_cast<typeof(a)>(MAXVAL));
inline const _Tp CLIP(const _Tp& a) {
return LIM(a, static_cast<_Tp>(0), static_cast<_Tp>(MAXVAL));
//return ((a)>0.0? ((a)<MAXVAL?(a):MAXVAL):0.0);
}

View File

@@ -874,6 +874,9 @@ void Thumbnail::getSpotWB (const procparams::ProcParams& params, int xp, int yp,
if (params.coarse.vflip) tr |= TR_VFLIP;
// calculate spot wb (copy & pasted from stdimagesource)
unsigned short igammatab[256];
for (int i=0; i<256; i++)
igammatab[i] = (unsigned short)(255.0*pow(i/255.0,CurveFactory::sRGBGamma));
int x; int y;
double reds = 0, greens = 0, blues = 0;
int rn = 0, gn = 0, bn = 0;