summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-11-17 05:15:13 +0000
committerMichael Meeks <michael.meeks@collabora.com>2014-11-17 05:15:13 +0000
commit97cb820d3c183a83652dd2779fa2da224ea44240 (patch)
treeffb773fccbce305fc2030977664c45116795552a /vcl
parent1989aea1c8df3fdd468efe85d3897e9ac5679db5 (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.hxx2
-rw-r--r--vcl/opengl/salbmp.cxx28
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;