[Libreoffice-commits] core.git: 3 commits - include/vcl vcl/opengl vcl/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Tue Dec 30 16:05:02 PST 2014


 include/vcl/opengl/OpenGLContext.hxx |   28 +++-------------------------
 vcl/opengl/gdiimpl.cxx               |    8 ++++----
 vcl/source/opengl/OpenGLContext.cxx  |   13 +++----------
 3 files changed, 10 insertions(+), 39 deletions(-)

New commits:
commit 5c60dab390d66a4d5abeaf548efecf3913b90839
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Dec 31 01:02:53 2014 +0100

    add some warnings to non-implemented features
    
    Change-Id: Icbd1a46dc426a0527422d55f77e67eac755bbc8b

diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index f75966f..69b4138 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1396,11 +1396,11 @@ void OpenGLSalGraphicsImpl::invert(
 
     if( nFlags & SAL_INVERT_TRACKFRAME )
     {
-
+        SAL_WARN("vcl.opengl", "check where this call is coming from! NOT IMPLEMENTED YET!");
     }
     else if( nFlags & SAL_INVERT_50 )
     {
-
+        SAL_WARN("vcl.opengl", "check where this call is coming from! NOT IMPLEMENTED YET!");
     }
     else // just invert
     {
@@ -1417,11 +1417,11 @@ void OpenGLSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry,
 
     if( nFlags & SAL_INVERT_TRACKFRAME )
     {
-
+        SAL_WARN("vcl.opengl", "check where this call is coming from! NOT IMPLEMENTED YET!");
     }
     else if( nFlags & SAL_INVERT_50 )
     {
-
+        SAL_WARN("vcl.opengl", "check where this call is coming from! NOT IMPLEMENTED YET!");
     }
     else // just invert
     {
commit e61fe35e7997082a4478dabde5123ecc63536538
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Tue Dec 30 19:16:35 2014 +0100

    prefer ptr_container to manual memory management
    
    Change-Id: I11326c2873aad5116fd70bfa31eb94e93fef3f40

diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 60fc7fd..bab85c2 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:
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 182a2e9..138a79e 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -1161,15 +1161,8 @@ void OpenGLContext::reset()
     // destroy all programs
     if( !maPrograms.empty() )
     {
-        boost::unordered_map<ProgramKey, OpenGLProgram*>::iterator it;
 
         makeCurrent();
-        it = maPrograms.begin();
-        while( it != maPrograms.end() )
-        {
-            delete it->second;
-            ++it;
-        }
         maPrograms.clear();
     }
 
@@ -1527,10 +1520,10 @@ void OpenGLContext::ReleaseFramebuffers()
 
 OpenGLProgram* OpenGLContext::GetProgram( const OUString& rVertexShader, const OUString& rFragmentShader )
 {
-    boost::unordered_map<ProgramKey, OpenGLProgram*>::iterator it;
     ProgramKey aKey( rVertexShader, rFragmentShader );
 
-    it = maPrograms.find( aKey );
+    boost::ptr_map<ProgramKey, OpenGLProgram>::iterator
+        it = maPrograms.find( aKey );
     if( it != maPrograms.end() )
         return it->second;
 
@@ -1541,7 +1534,7 @@ OpenGLProgram* OpenGLContext::GetProgram( const OUString& rVertexShader, const O
         return NULL;
     }
 
-    maPrograms[aKey] = pProgram;
+    maPrograms.insert(aKey, pProgram);
     return pProgram;
 }
 
commit c805a996c97097d2a47039355fffba678a84e1b0
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Tue Dec 30 18:49:01 2014 +0100

    use constructor initializer list
    
    Change-Id: Ieede6dec05f63ed0fa1dde376b2e89c381601cd6

diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index a98f825..60fc7fd 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -163,10 +163,10 @@ struct ProgramKey
     OUString maVertexShader;
     OUString maFragmentShader;
 
-    ProgramKey( const OUString& rVertexShader, const OUString& rFragmentShader )
+    ProgramKey( const OUString& rVertexShader, const OUString& rFragmentShader ):
+        maVertexShader(rVertexShader),
+        maFragmentShader(rFragmentShader)
     {
-        maVertexShader = rVertexShader;
-        maFragmentShader = rFragmentShader;
     }
 };
 


More information about the Libreoffice-commits mailing list