diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2014-11-17 05:15:13 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2014-11-17 22:39:03 +0000 |
commit | bd14a48e414f4f04cc1b08f5ac29c403f161d69d (patch) | |
tree | b603e81c8069ebf4d7051f6089715a6b23658650 /vcl | |
parent | dfeaee01a30109883e41f45faf28fc247dadb3b2 (diff) |
vcl: always use the default windows' GL Context for now to create bitmaps.
Change-Id: Ie20b10656788113709b0b0720d3cae2653639d78
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/opengl/salbmp.hxx | 2 | ||||
-rw-r--r-- | vcl/opengl/salbmp.cxx | 28 |
2 files changed, 20 insertions, 10 deletions
diff --git a/vcl/inc/opengl/salbmp.hxx b/vcl/inc/opengl/salbmp.hxx index dbb29d80f802..99956458a8a7 100644 --- a/vcl/inc/opengl/salbmp.hxx +++ b/vcl/inc/opengl/salbmp.hxx @@ -52,6 +52,8 @@ private: int mnBufHeight; std::deque< OpenGLSalBitmapOp* > maPendingOps; + bool makeCurrent(); + public: OpenGLSalBitmap(); virtual ~OpenGLSalBitmap(); diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index 4b5287e3c8c1..780c268c5516 100644 --- a/vcl/opengl/salbmp.cxx +++ b/vcl/opengl/salbmp.cxx @@ -395,7 +395,7 @@ GLuint OpenGLSalBitmap::CreateTexture() } } - mpContext->makeCurrent(); + makeCurrent(); maTexture = OpenGLTexture (mnBufWidth, mnBufHeight, nFormat, nType, pData ); SAL_INFO( "vcl.opengl", "Created texture " << maTexture.Id() ); @@ -449,7 +449,7 @@ bool OpenGLSalBitmap::ReadTexture() return false; } - mpContext->makeCurrent(); + makeCurrent(); maTexture.Read( nFormat, nType, pData ); mnBufWidth = mnWidth; mnBufHeight = mnHeight; @@ -462,6 +462,20 @@ sal_uInt16 OpenGLSalBitmap::GetBitCount() const return mnBits; } +bool OpenGLSalBitmap::makeCurrent() +{ + OpenGLContextProvider *pProvider; + pProvider = dynamic_cast< OpenGLContextProvider* >( ImplGetDefaultWindow()->GetGraphics() ); + if( pProvider == NULL ) + { + SAL_WARN( "vcl.opengl", "Couldn't get default OpenGL context provider" ); + return false; + } + mpContext = pProvider->GetOpenGLContext(); + mpContext->makeCurrent(); + return true; +} + BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( bool /*bReadOnly*/ ) { if( !maUserBuffer.get() ) @@ -474,15 +488,9 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( bool /*bReadOnly*/ ) if( !maPendingOps.empty() ) { - OpenGLContextProvider *pProvider; - pProvider = dynamic_cast< OpenGLContextProvider* >( ImplGetDefaultWindow()->GetGraphics() ); - if( pProvider == NULL ) - { - SAL_WARN( "vcl.opengl", "Couldn't get default OpenGL context provider" ); + if (!makeCurrent()) return NULL; - } - mpContext = pProvider->GetOpenGLContext(); - mpContext->makeCurrent(); + SAL_INFO( "vcl.opengl", "** Creating texture and reading it back immediatly" ); if( !CreateTexture() || !AllocateUserData() || !ReadTexture() ) return NULL; |