From: Cristy Date: Wed, 8 Aug 2018 00:52:12 +0000 (-0400) Subject: ... X-Git-Tag: 7.0.8-10~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5a1a4575d36c781e772abf18bf57ae62042cac1b;p=imagemagick ... --- diff --git a/coders/mat.c b/coders/mat.c index 08030b61d..259c8158b 100644 --- a/coders/mat.c +++ b/coders/mat.c @@ -185,9 +185,9 @@ static void InsertComplexDoubleRow(Image *image,double *p,int y,double MinVal, int x; register Quantum *q; - if (MinVal == 0) + if (MinVal >= 0) MinVal = -1; - if (MaxVal == 0) + if (MaxVal <= 0) MaxVal = 1; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); @@ -197,7 +197,7 @@ static void InsertComplexDoubleRow(Image *image,double *p,int y,double MinVal, { if (*p > 0) { - f=(*p/MaxVal)*(QuantumRange-GetPixelRed(image,q)); + f=(*p/MaxVal)*(Quantum) (QuantumRange-GetPixelRed(image,q)); if ((f+GetPixelRed(image,q)) >= QuantumRange) SetPixelRed(image,QuantumRange,q); else @@ -216,7 +216,7 @@ static void InsertComplexDoubleRow(Image *image,double *p,int y,double MinVal, } if (*p < 0) { - f=(*p/MinVal)*(QuantumRange-GetPixelBlue(image,q)); + f=(*p/MinVal)*(Quantum) (QuantumRange-GetPixelBlue(image,q)); if ((f+GetPixelBlue(image,q)) >= QuantumRange) SetPixelBlue(image,QuantumRange,q); else @@ -248,9 +248,9 @@ static void InsertComplexFloatRow(Image *image,float *p,int y,double MinVal, int x; register Quantum *q; - if (MinVal == 0) + if (MinVal >= 0) MinVal = -1; - if (MaxVal == 0) + if (MaxVal <= 0) MaxVal = 1; q = QueueAuthenticPixels(image, 0, y, image->columns, 1,exception); @@ -260,14 +260,13 @@ static void InsertComplexFloatRow(Image *image,float *p,int y,double MinVal, { if (*p > 0) { - f=(*p/MaxVal)*(QuantumRange-GetPixelRed(image,q)); - if ((f+GetPixelRed(image,q)) >= QuantumRange) - SetPixelRed(image,QuantumRange,q); - else + f=(*p/MaxVal)*(Quantum) (QuantumRange-GetPixelRed(image,q)); + if ((f+GetPixelRed(image,q)) < QuantumRange) SetPixelRed(image,GetPixelRed(image,q)+ClampToQuantum(f),q); + else + SetPixelRed(image,QuantumRange,q); f/=2.0; - if ((f > 0) && (f < GetPixelGreen(image,q)) && - (f < GetPixelBlue(image,q))) + if (f < GetPixelGreen(image,q)) { SetPixelBlue(image,GetPixelBlue(image,q)-ClampToQuantum(f),q); SetPixelGreen(image,GetPixelBlue(image,q),q); @@ -280,14 +279,13 @@ static void InsertComplexFloatRow(Image *image,float *p,int y,double MinVal, } if (*p < 0) { - f=(*p/MaxVal)*(QuantumRange-GetPixelBlue(image,q)); + f=(*p/MaxVal)*(Quantum) (QuantumRange-GetPixelBlue(image,q)); if ((f > 0) && ((f+GetPixelBlue(image,q)) < QuantumRange)) SetPixelBlue(image,GetPixelBlue(image,q)+ClampToQuantum(f),q); else SetPixelBlue(image,QuantumRange,q); f/=2.0; - if ((f > 0) && (f < GetPixelGreen(image,q)) && - (f < GetPixelRed(image,q))) + if (f < GetPixelGreen(image,q)) { SetPixelRed(image,GetPixelRed(image,q)-ClampToQuantum(f),q); SetPixelGreen(image,GetPixelRed(image,q),q);