]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To introduce caching for textures
authorapo <apo@opencascade.com>
Tue, 6 Dec 2005 06:35:17 +0000 (06:35 +0000)
committerapo <apo@opencascade.com>
Tue, 6 Dec 2005 06:35:17 +0000 (06:35 +0000)
src/PIPELINE/VISUPipeLine.cxx
src/PIPELINE/VISU_GaussPointsPL.cxx
src/PIPELINE/VISU_GaussPointsPL.hxx

index b985bde66b2dbaba747887aadd49640f2bd6218c..d1ac8fe3f9f25b176508c889eda26470f9f6c7e3 100644 (file)
@@ -43,6 +43,7 @@ typedef VISU_GaussPointsPL TPresent;
 
 #include <vtkRenderWindowInteractor.h>
 #include <vtkRenderWindow.h>
+#include <vtkImageData.h>
 #include <vtkRenderer.h>
 #include <vtkCamera.h>
 #include <vtkActor.h>
@@ -141,7 +142,8 @@ int main(int argc, char** argv){
          strcat( anAlphaTexture, "/share/salome/resources/sprite_alpha.vti" );
          //cout << anAlphaTexture << endl;
 
-         aPresent->SetImageData( VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture ) );
+         vtkSmartPointer<vtkImageData> aTextureValue = VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
+         aPresent->SetImageData( aTextureValue.GetPointer() );
 
          aPresent->Update();
 
index 3c180fa76e0623566ce035fc4546f810a210abb4..c0a86dc9157a610a69c05c9fbd7d65970bb22e5c 100644 (file)
@@ -616,7 +616,7 @@ VISU_GaussPointsPL
 }
 
 //----------------------------------------------------------------------------
-vtkImageData*
+vtkSmartPointer<vtkImageData>
 VISU_GaussPointsPL
 ::MakeTexture( const char* theMainTexture, 
               const char* theAlphaTexture )
@@ -641,8 +641,10 @@ VISU_GaussPointsPL
   if(aMainImageSize[0] != anAlphaImageSize[0] || aMainImageSize[1] != anAlphaImageSize[1])
     return NULL;
 
+  vtkSmartPointer<vtkImageData> aCompositeImageData = vtkImageData::New();
+  aCompositeImageData->Delete();
+
   int aNbCompositeComponents = 4;
-  vtkImageData* aCompositeImageData = vtkImageData::New();
   aCompositeImageData->SetDimensions(aMainImageSize);
   aCompositeImageData->SetScalarTypeToUnsignedChar();        
   aCompositeImageData->SetNumberOfScalarComponents(aNbCompositeComponents);
index 86d63dc94cad55ed151e2f024c2bc8a94f5cceb0..b342ab56f04f7a3832929bd34094fe8130b31552 100644 (file)
@@ -251,7 +251,7 @@ public:
    * Second parameter - texture for alpha mask.
    */
   static
-  vtkImageData*
+  vtkSmartPointer<vtkImageData>
   MakeTexture( const char* theMainTexture,
               const char* theAlphaTexture );