diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-12-30 19:16:35 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-12-31 01:04:30 +0100 |
commit | e61fe35e7997082a4478dabde5123ecc63536538 (patch) | |
tree | bbe0b82f5477c35e43a7b4b91e77330f7bc0f2a8 /include | |
parent | c805a996c97097d2a47039355fffba678a84e1b0 (diff) |
prefer ptr_container to manual memory management
Change-Id: I11326c2873aad5116fd70bfa31eb94e93fef3f40
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/opengl/OpenGLContext.hxx | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index 60fc7fda9691..bab85c2fed6f 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -52,6 +52,7 @@ class NSOpenGLView; #include <vcl/vclopengl_dllapi.hxx> #include <boost/scoped_ptr.hpp> #include <boost/unordered_map.hpp> +#include <boost/ptr_container/ptr_map.hpp> #include <vcl/window.hxx> #include <tools/gen.hxx> #include <vcl/syschild.hxx> @@ -158,30 +159,7 @@ struct GLWindow ~GLWindow(); }; -struct ProgramKey -{ - OUString maVertexShader; - OUString maFragmentShader; - - ProgramKey( const OUString& rVertexShader, const OUString& rFragmentShader ): - maVertexShader(rVertexShader), - maFragmentShader(rFragmentShader) - { - } -}; - -inline bool operator==( ProgramKey const& k1, ProgramKey const& k2 ) -{ - return k1.maVertexShader == k2.maVertexShader && k1.maFragmentShader == k2.maFragmentShader; -} - -inline std::size_t hash_value( ProgramKey const& rKey ) -{ - std::size_t nSeed = 0x9e3779b9; - nSeed = rKey.maVertexShader.hashCode(); - nSeed = rKey.maFragmentShader.hashCode() + 0x9e3779b9 + (nSeed << 6) + (nSeed >> 2); - return nSeed; -} +typedef std::pair<OUString, OUString> ProgramKey; class VCLOPENGL_DLLPUBLIC OpenGLContext { @@ -278,7 +256,7 @@ private: OpenGLFramebuffer* mpFirstFramebuffer; OpenGLFramebuffer* mpLastFramebuffer; - boost::unordered_map<ProgramKey, OpenGLProgram*> maPrograms; + boost::ptr_map<ProgramKey, OpenGLProgram> maPrograms; OpenGLProgram* mpCurrentProgram; public: |