summaryrefslogtreecommitdiff
path: root/vcl/opengl/x11/gdiimpl.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-05-20 14:16:09 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-05-21 10:04:50 +0100
commit5d4e68d51eecfbe37e17f59cc7f7f042c69a65e9 (patch)
tree26676c62be78ba61a91ae9168cc806d7a23e5b9e /vcl/opengl/x11/gdiimpl.cxx
parent81283a891f274226113f6d136c251c2ba1538b4c (diff)
move glX stuff to X-only modules
Change-Id: I8ca818dac72f0368b6af10c838603e63c7c85b1e
Diffstat (limited to 'vcl/opengl/x11/gdiimpl.cxx')
-rw-r--r--vcl/opengl/x11/gdiimpl.cxx64
1 files changed, 62 insertions, 2 deletions
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
index 1137a3a170c4..105cda3669b0 100644
--- a/vcl/opengl/x11/gdiimpl.cxx
+++ b/vcl/opengl/x11/gdiimpl.cxx
@@ -623,7 +623,7 @@ bool X11OpenGLSalGraphicsImpl::FillPixmapFromScreen( X11Pixmap* pPixmap, int nX,
SAL_INFO( "vcl.opengl", "FillPixmapFromScreen" );
- if( !OpenGLHelper::GetVisualInfo( pDisplay, nScreen.getXScreen(), aVisualInfo ) )
+ if (!SalDisplay::BestOpenGLVisual(pDisplay, nScreen.getXScreen(), aVisualInfo))
return false;
// make sure everything is synced up before reading back
@@ -655,6 +655,66 @@ typedef o3tl::lru_map<ControlCacheKey, std::unique_ptr<TextureCombo>, ControlCac
vcl::DeleteOnDeinit<ControlCacheType> gTextureCache(new ControlCacheType(200));
+namespace
+{
+ GLXFBConfig GetPixmapFBConfig( Display* pDisplay, bool& bInverted )
+ {
+ OpenGLZone aZone;
+
+ int nScreen = DefaultScreen( pDisplay );
+ GLXFBConfig *aFbConfigs;
+ int i, nFbConfigs, nValue;
+
+ aFbConfigs = glXGetFBConfigs( pDisplay, nScreen, &nFbConfigs );
+ for( i = 0; i < nFbConfigs; i++ )
+ {
+ glXGetFBConfigAttrib( pDisplay, aFbConfigs[i], GLX_DRAWABLE_TYPE, &nValue );
+ if( !(nValue & GLX_PIXMAP_BIT) )
+ continue;
+
+ glXGetFBConfigAttrib( pDisplay, aFbConfigs[i], GLX_BIND_TO_TEXTURE_TARGETS_EXT, &nValue );
+ if( !(nValue & GLX_TEXTURE_2D_BIT_EXT) )
+ continue;
+
+ glXGetFBConfigAttrib( pDisplay, aFbConfigs[i], GLX_DEPTH_SIZE, &nValue );
+ if( nValue != 24 )
+ continue;
+
+ glXGetFBConfigAttrib( pDisplay, aFbConfigs[i], GLX_RED_SIZE, &nValue );
+ if( nValue != 8 )
+ continue;
+ SAL_INFO( "vcl.opengl", "Red is " << nValue );
+
+ // TODO: lfrb: Make it configurable wrt RGB/RGBA
+ glXGetFBConfigAttrib( pDisplay, aFbConfigs[i], GLX_BIND_TO_TEXTURE_RGB_EXT, &nValue );
+ if( nValue == False )
+ {
+ glXGetFBConfigAttrib( pDisplay, aFbConfigs[i], GLX_BIND_TO_TEXTURE_RGBA_EXT, &nValue );
+ if( nValue == False )
+ continue;
+ }
+
+ glXGetFBConfigAttrib( pDisplay, aFbConfigs[i], GLX_Y_INVERTED_EXT, &nValue );
+
+ // Looks like that X sends GLX_DONT_CARE but this usually means "true" for most
+ // of the X implementations. Investigation on internet pointed that this could be
+ // safely "true" all the time (for example gnome-shell always assumes "true").
+ bInverted = nValue == True || nValue == int(GLX_DONT_CARE);
+
+ break;
+ }
+
+ if( i == nFbConfigs )
+ {
+ SAL_WARN( "vcl.opengl", "Unable to find FBconfig for pixmap texturing" );
+ return nullptr;
+ }
+
+ CHECK_GL_ERROR();
+ return aFbConfigs[i];
+ }
+}
+
bool X11OpenGLSalGraphicsImpl::RenderPixmap(X11Pixmap* pPixmap, X11Pixmap* pMask, int nX, int nY, TextureCombo& rCombo)
{
const int aAttribs[] =
@@ -675,7 +735,7 @@ bool X11OpenGLSalGraphicsImpl::RenderPixmap(X11Pixmap* pPixmap, X11Pixmap* pMask
//glClear( GL_COLOR_BUFFER_BIT );
XSync( pDisplay, 0 );
- GLXFBConfig pFbConfig = OpenGLHelper::GetPixmapFBConfig( pDisplay, bInverted );
+ GLXFBConfig pFbConfig = GetPixmapFBConfig( pDisplay, bInverted );
GLXPixmap pGlxPixmap = glXCreatePixmap( pDisplay, pFbConfig, pPixmap->GetPixmap(), aAttribs);
GLXPixmap pGlxMask;
if( pMask != nullptr )