From 9f94808c3f863a601d94ae5b0798d81a426ea9c4 Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 6 Dec 2005 06:35:17 +0000 Subject: [PATCH] To introduce caching for textures --- src/PIPELINE/VISUPipeLine.cxx | 4 +++- src/PIPELINE/VISU_GaussPointsPL.cxx | 6 ++++-- src/PIPELINE/VISU_GaussPointsPL.hxx | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/PIPELINE/VISUPipeLine.cxx b/src/PIPELINE/VISUPipeLine.cxx index b985bde6..d1ac8fe3 100644 --- a/src/PIPELINE/VISUPipeLine.cxx +++ b/src/PIPELINE/VISUPipeLine.cxx @@ -43,6 +43,7 @@ typedef VISU_GaussPointsPL TPresent; #include #include +#include #include #include #include @@ -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 aTextureValue = VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture ); + aPresent->SetImageData( aTextureValue.GetPointer() ); aPresent->Update(); diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 3c180fa7..c0a86dc9 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -616,7 +616,7 @@ VISU_GaussPointsPL } //---------------------------------------------------------------------------- -vtkImageData* +vtkSmartPointer 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 aCompositeImageData = vtkImageData::New(); + aCompositeImageData->Delete(); + int aNbCompositeComponents = 4; - vtkImageData* aCompositeImageData = vtkImageData::New(); aCompositeImageData->SetDimensions(aMainImageSize); aCompositeImageData->SetScalarTypeToUnsignedChar(); aCompositeImageData->SetNumberOfScalarComponents(aNbCompositeComponents); diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index 86d63dc9..b342ab56 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -251,7 +251,7 @@ public: * Second parameter - texture for alpha mask. */ static - vtkImageData* + vtkSmartPointer MakeTexture( const char* theMainTexture, const char* theAlphaTexture ); -- 2.39.2