summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-12-30 19:16:35 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-01-28 14:28:49 +0000
commitfadd4a2c740e2abe911d29d00f273d115b2c9b54 (patch)
treee5280490e92030e9d160fd7eda44b8e424235444 /include
parent1313ab6957d8be2fe388af04ecce82a50f0c71c0 (diff)
prefer ptr_container to manual memory management
Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Conflicts: vcl/source/opengl/OpenGLContext.cxx Change-Id: I11326c2873aad5116fd70bfa31eb94e93fef3f40
Diffstat (limited to 'include')
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx28
1 files changed, 3 insertions, 25 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 1ae9ac6e0545..e2d6b777c9ee 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>
@@ -161,30 +162,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
{
@@ -289,7 +267,7 @@ private:
OpenGLFramebuffer* mpFirstFramebuffer;
OpenGLFramebuffer* mpLastFramebuffer;
- boost::unordered_map<ProgramKey, OpenGLProgram*> maPrograms;
+ boost::ptr_map<ProgramKey, OpenGLProgram> maPrograms;
OpenGLProgram* mpCurrentProgram;
#ifdef DBG_UTIL
std::set<SalGraphicsImpl*> maParents;