diff options
-rw-r--r-- | include/vcl/opengl/OpenGLContext.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/opengl/program.hxx | 1 | ||||
-rw-r--r-- | vcl/source/opengl/OpenGLContext.cxx | 14 |
3 files changed, 8 insertions, 9 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index c8f2cb4bfbe7..d733560f2a2b 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -275,7 +275,7 @@ private: OUString fragmentShader; OString preamble; }; - boost::ptr_map<ProgramKey, OpenGLProgram> maPrograms; + std::map<ProgramKey, boost::shared_ptr<OpenGLProgram> > maPrograms; OpenGLProgram* mpCurrentProgram; #ifdef DBG_UTIL std::set<SalGraphicsImpl*> maParents; diff --git a/vcl/inc/opengl/program.hxx b/vcl/inc/opengl/program.hxx index 8b42dd486fc4..438d7e3d4cc6 100644 --- a/vcl/inc/opengl/program.hxx +++ b/vcl/inc/opengl/program.hxx @@ -39,6 +39,7 @@ private: TextureList maTextures; bool mbBlending; + OpenGLProgram(const OpenGLProgram ¬Implemented); public: OpenGLProgram(); ~OpenGLProgram(); diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index be14c2261359..70c263a01ed3 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -13,6 +13,7 @@ #include <vcl/sysdata.hxx> #include <boost/scoped_array.hpp> +#include <boost/make_shared.hpp> #include <vcl/pngwrite.hxx> #include <vcl/bmpacc.hxx> #include <vcl/graph.hxx> @@ -1588,20 +1589,17 @@ OpenGLProgram* OpenGLContext::GetProgram( const OUString& rVertexShader, const O { ProgramKey aKey( rVertexShader, rFragmentShader, preamble ); - boost::ptr_map<ProgramKey, OpenGLProgram>::iterator + std::map< ProgramKey, boost::shared_ptr<OpenGLProgram> >::iterator it = maPrograms.find( aKey ); if( it != maPrograms.end() ) - return it->second; + return it->second.get(); - OpenGLProgram* pProgram = new OpenGLProgram; + boost::shared_ptr<OpenGLProgram> pProgram = boost::make_shared<OpenGLProgram>(); if( !pProgram->Load( rVertexShader, rFragmentShader, preamble ) ) - { - delete pProgram; return NULL; - } - maPrograms.insert(aKey, pProgram); - return pProgram; + maPrograms.insert(std::pair<ProgramKey, boost::shared_ptr<OpenGLProgram> >(aKey, pProgram)); + return pProgram.get(); } OpenGLProgram* OpenGLContext::UseProgram( const OUString& rVertexShader, const OUString& rFragmentShader, const OString& preamble ) |