[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/digikam/libs
From:       Gilles Caulier <caulier.gilles () gmail ! com>
Date:       2010-02-16 13:27:42
Message-ID: 1266326862.374897.4822.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1090981 by cgilles:

compile


 M  +6 -8      dimg/filters/curves/imagecurves.cpp  
 M  +21 -14    dimg/filters/dimgimagefilters.h  
 M  +1 -1      dimg/filters/levels/imagelevels.cpp  
 D             dimg/filters/levels/levelsfilter.cpp  
 D             dimg/filters/levels/levelsfilter.h  
 M  +6 -6      dimg/filters/sharp/dimgrefocus.cpp  
 M  +11 -10    dimg/filters/sharp/dimgunsharpmask.cpp  
 M  +0 -2      widgets/common/curveswidget.cpp  
 M  +1 -1      widgets/common/curveswidget.h  


--- trunk/extragear/graphics/digikam/libs/dimg/filters/curves/imagecurves.cpp \
#1090980:1090981 @@ -26,8 +26,6 @@
  *
  * ============================================================ */
 
-#define CLAMP(x,l,u) ((x)<(l)?(l):((x)>(u)?(u):(x)))
-
 #include "imagecurves.h"
 
 // C++ includes
@@ -460,8 +458,8 @@
     dy2 = deltas[2][1];
     dy3 = deltas[3][1];
 
-    lastx = (int)CLAMP (x, 0, d->segmentMax);
-    lasty = (int)CLAMP (y, 0, d->segmentMax);
+    lastx = (int)CLAMP (x, 0.0, (double)d->segmentMax);
+    lasty = (int)CLAMP (y, 0.0, (double)d->segmentMax);
 
     d->curves->curve[channel][lastx] = lasty;
 
@@ -481,8 +479,8 @@
        dy  += dy2;
        dy2 += dy3;
 
-       newx = CLAMP(ROUND (x), 0, d->segmentMax);
-       newy = CLAMP(ROUND (y), 0, d->segmentMax);
+       newx = CLAMP((int)lround(x), 0, d->segmentMax);
+       newy = CLAMP((int)lround(y), 0, d->segmentMax);
 
        // If this point is different than the last one...then draw it.
 
@@ -529,9 +527,9 @@
        {
           // To add gamma correction use func(v ^ g) ^ 1/g instead.
 
-          val = (float)(d->segmentMax) * curvesLutFunc( d->lut->nchannels, i, v / \
(float)(d->segmentMax)) + 0.5; +          val = (double)(d->segmentMax) * \
curvesLutFunc( d->lut->nchannels, i, v / (float)(d->segmentMax)) + 0.5;  
-          d->lut->luts[i][v] = (unsigned short)CLAMP (val, 0, d->segmentMax);
+          d->lut->luts[i][v] = (unsigned short)CLAMP(val, 0.0, \
(double)d->segmentMax);  }
     }
 }
--- trunk/extragear/graphics/digikam/libs/dimg/filters/dimgimagefilters.h \
#1090980:1090981 @@ -62,10 +62,10 @@
                                    double Norm)
     {
        double lfMix = RedGain * (double)R + GreenGain * (double)G + BlueGain * \
                (double)B;
-       lfMix *= Norm;
-       int segment = sixteenBit ? 65535 : 255;
+       lfMix        *= Norm;
+       int segment  = sixteenBit ? 65535 : 255;
 
-       return( (unsigned short)CLAMP (lfMix, 0, segment) );
+       return( (unsigned short)CLAMP((int)lfMix, 0, segment));
     };
 
     inline int setPositionAdjusted (int Width, int Height, int X, int Y)
@@ -77,25 +77,32 @@
 
 public:   // Public methods.
 
-    void invertImage(uchar *data, int w, int h, bool sixteenBit);
-    void channelMixerImage(uchar *data, int Width, int Height, bool sixteenBit,
+    void invertImage(uchar* data, int w, int h, bool sixteenBit);
+    
+    void channelMixerImage(uchar* data, int Width, int Height, bool sixteenBit,
                            bool bPreserveLum, bool bMonochrome,
                            float rrGain, float rgGain, float rbGain,
                            float grGain, float ggGain, float gbGain,
                            float brGain, float bgGain, float bbGain);
-    void changeTonality(uchar *data, int width, int height, bool sixteenBit,
+                           
+    void changeTonality(uchar* data, int width, int height, bool sixteenBit,
                         int redMask, int greenMask, int blueMask);
-    void gaussianBlurImage(uchar *data, int width, int height, bool sixteenBit, int \
                radius);
-    void sharpenImage(uchar *data, int width, int height, bool sixteenBit, int \
                radius);
-    void unsharpMaskImage(uchar *data, int width, int height, bool sixteenBit,
+                        
+    void gaussianBlurImage(uchar* data, int width, int height, bool sixteenBit, int \
radius); +    
+    void sharpenImage(uchar* data, int width, int height, bool sixteenBit, int \
radius); +    
+    void unsharpMaskImage(uchar* data, int width, int height, bool sixteenBit,
                           int radius, double amount, double threshold);
-    void refocusImage(uchar *data, int width, int height, bool sixteenBit, int \
matrixSize, +                          
+    void refocusImage(uchar* data, int width, int height, bool sixteenBit, int \
                matrixSize,
                       double radius, double gauss, double correlation, double \
                noise);
-    void pixelAntiAliasing(uchar *data, int Width, int Height, double X, double Y,
-                           uchar *A, uchar *R, uchar *G, uchar *B);
+                      
+    void pixelAntiAliasing(uchar* data, int Width, int Height, double X, double Y,
+                           uchar* A, uchar* R, uchar* G, uchar* B);
 
-    void pixelAntiAliasing16(unsigned short *data, int Width, int Height, double X, \
                double Y,
-                             unsigned short *A, unsigned short *R, unsigned short \
*G, unsigned short *B); +    void pixelAntiAliasing16(unsigned short* data, int \
Width, int Height, double X, double Y, +                             unsigned short* \
A, unsigned short* R, unsigned short* G, unsigned short* B);  };
 
 }  // namespace Digikam
--- trunk/extragear/graphics/digikam/libs/dimg/filters/levels/imagelevels.cpp \
#1090980:1090981 @@ -442,7 +442,7 @@
           val = (float)(d->sixteenBit ? 65535 : 255) *
                 levelsLutFunc( d->lut->nchannels, i, v/(float)(d->sixteenBit ? 65535 \
: 255)) + 0.5;  
-          d->lut->luts[i][v] = (unsigned short)CLAMP (val, 0, (d->sixteenBit ? 65535 \
: 255)); +          d->lut->luts[i][v] = (unsigned short)CLAMP(val, 0.0, \
(d->sixteenBit ? 65535.0 : 255.0));  }
     }
 }
--- trunk/extragear/graphics/digikam/libs/dimg/filters/sharp/dimgrefocus.cpp \
#1090980:1090981 @@ -225,9 +225,9 @@
                     ptr = &destData[index2*4];
 
                     // Overwrite RGB values to destination.
-                    ptr[0] = (uchar) CLAMP (valBlue,  0, 255);
-                    ptr[1] = (uchar) CLAMP (valGreen, 0, 255);
-                    ptr[2] = (uchar) CLAMP (valRed,   0, 255);
+                    ptr[0] = (uchar) CLAMP(valBlue,  0.0, 255.0);
+                    ptr[1] = (uchar) CLAMP(valGreen, 0.0, 255.0);
+                    ptr[2] = (uchar) CLAMP(valRed,   0.0, 255.0);
                 }
             }
             else                 // 16 bits image.
@@ -266,9 +266,9 @@
                     ptr = &destData16[index2*4];
 
                     // Overwrite RGB values to destination.
-                    ptr[0] = (unsigned short) CLAMP (valBlue,  0, 65535);
-                    ptr[1] = (unsigned short) CLAMP (valGreen, 0, 65535);
-                    ptr[2] = (unsigned short) CLAMP (valRed,   0, 65535);
+                    ptr[0] = (unsigned short) CLAMP(valBlue,  0.0, 65535.0);
+                    ptr[1] = (unsigned short) CLAMP(valGreen, 0.0, 65535.0);
+                    ptr[2] = (unsigned short) CLAMP(valRed,   0.0, 65535.0);
                 }
             }
         }
--- trunk/extragear/graphics/digikam/libs/dimg/filters/sharp/dimgunsharpmask.cpp \
#1090980:1090981 @@ -58,12 +58,13 @@
 
 void DImgUnsharpMask::filterImage()
 {
-    int    progress;
-    int    quantum;
-    double quantumThreshold;
-    double value;
-    DColor p;
-    DColor q;
+    int      progress;
+    long int quantum;
+    long int zero = 0;
+    double   quantumThreshold;
+    double   value;
+    DColor   p;
+    DColor   q;
 
     if (m_orgImage.isNull())
     {
@@ -91,7 +92,7 @@
             else
                 value = (double)(p.red()) + value*m_amount;
 
-            q.setRed(CLAMP(lround(value), 0, quantum));
+            q.setRed(CLAMP(lround(value), zero, quantum));
 
             // Green Channel.
             value = (double)(p.green())-(double)(q.green());
@@ -101,7 +102,7 @@
             else
                 value = (double)(p.green()) + value*m_amount;
 
-            q.setGreen(CLAMP(lround(value), 0, quantum));
+            q.setGreen(CLAMP(lround(value), zero, quantum));
 
             // Blue Channel.
             value = (double)(p.blue())-(double)(q.blue());
@@ -111,7 +112,7 @@
             else
                 value = (double)(p.blue()) + value*m_amount;
 
-            q.setBlue(CLAMP(lround(value), 0, quantum));
+            q.setBlue(CLAMP(lround(value), zero, quantum));
 
             // Alpha Channel.
             value = (double)(p.alpha())-(double)(q.alpha());
@@ -121,7 +122,7 @@
             else
                 value = (double)(p.alpha()) + value*m_amount;
 
-            q.setAlpha(CLAMP(lround(value), 0, quantum));
+            q.setAlpha(CLAMP(lround(value), zero, quantum));
 
             m_destImage.setPixelColor(x, y, q);
         }
--- trunk/extragear/graphics/digikam/libs/widgets/common/curveswidget.cpp \
#1090980:1090981 @@ -21,8 +21,6 @@
  *
  * ============================================================ */
 
-#define CLAMP(x,l,u) ((x)<(l)?(l):((x)>(u)?(u):(x)))
-
 #include "curveswidget.moc"
 
 // C++ includes
--- trunk/extragear/graphics/digikam/libs/widgets/common/curveswidget.h \
#1090980:1090981 @@ -6,7 +6,7 @@
  * Date        : 2004-12-01
  * Description : a widget to draw histogram curves
  *
- * Copyright (C) 2004-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2004-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic