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

List:       kde-commits
Subject:    kdeextragear-3/digikamimageplugins/common/cimgiface
From:       Gilles Caulier <caulier.gilles () free ! fr>
Date:       2005-03-30 19:57:50
Message-ID: 20050330195750.BC552632 () office ! kde ! org
[Download RAW message or body]

CVS commit by cgilles: 

using kde temp folder instead /tmp


  M +29 -4     cimgiface.cpp   1.7
  M +5 -2      cimgiface.h   1.6


--- kdeextragear-3/digikamimageplugins/common/cimgiface/cimgiface.cpp  #1.6:1.7
@@ -22,4 +22,11 @@
  * ============================================================ */
   
+ // C Ansi includes
+
+extern "C"
+{
+#include <unistd.h>
+}
+  
 // C++ includes. 
  
@@ -32,8 +39,10 @@
 #include <qobject.h>
 #include <qevent.h>
+#include <qfile.h>
 
 // KDE includes.
 
 #include <kapplication.h>
+#include <kstandarddirs.h>
 #include <kdebug.h>
 
@@ -80,8 +89,15 @@ CimgIface::CimgIface(uint *data, uint wi
     m_linear      = linearInterpolation;
 
+    m_tmpMaskFile = QString::null;
+    
     if (inPaintingMask)
        {
+       KStandardDirs dir;
+       m_tmpMaskFile = dir.saveLocation("tmp");
+       m_tmpMaskFile.append(QString::number(getpid()));
+       m_tmpMaskFile.append(".png");
        m_inPaintingMask = inPaintingMask->copy();
-       m_inPaintingMask.save("/tmp/mask.png", "PNG");
+       m_inPaintingMask.save(m_tmpMaskFile, "PNG");
+       kdDebug() << "CimgIface::InPainting Mask : " << m_tmpMaskFile << endl;
        }
         
@@ -108,4 +124,11 @@ CimgIface::~CimgIface()
 { 
     stopComputation();
+    
+    if (m_tmpMaskFile != QString::null)
+       {
+       // Remove temporary inpainting mask.
+       QFile mask(m_tmpMaskFile);
+       mask.remove();
+       }
 }
 
@@ -323,5 +346,5 @@ bool CimgIface::prepare_inpaint()
 {
     //const char *file_m = NULL; //cimg_option("-m",(const char*)NULL,"Input \
                inpainting mask");
-    const char *file_m = "/tmp/mask.png";
+    const char *file_m = m_tmpMaskFile.latin1();
     
     if (!file_m) 
@@ -331,6 +354,8 @@ bool CimgIface::prepare_inpaint()
        }
 
-    const unsigned int dilate  = 0; //cimg_option("-dilate",0,"Inpainting mask \
                dilatation");
-    const unsigned int ip_init = 3; //cimg_option("-init",3,"Inpainting init \
(0=black, 1=white, 2=noise, 3=unchanged, 4=interpol)"); +    \
//cimg_option("-dilate",0,"Inpainting mask dilatation"); +    const unsigned int \
dilate  = 0;  +    //cimg_option("-init",3,"Inpainting init (0=black, 1=white, \
2=noise, 3=unchanged, 4=interpol)"); +    const unsigned int ip_init = 3; 
     
     if (cimg::strncasecmp("block",file_m,5)) 

--- kdeextragear-3/digikamimageplugins/common/cimgiface/cimgiface.h  #1.5:1.6
@@ -27,4 +27,5 @@
 #include <qthread.h>
 #include <qimage.h>
+#include <qstring.h>
 
 // Local include.
@@ -78,8 +79,10 @@ private:
     int       m_imageHeight;
     
-    QImage    m_inPaintingMask;
-    
     bool      m_cancel;   // Used to stop thread during calculations.
     
+    QString   m_tmpMaskFile;
+    
+    QImage    m_inPaintingMask;
+    
     QObject  *m_parent;
 


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

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