diff options
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/gdi/gdiimpl.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salgdi.cxx | 14 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salvd.cxx | 151 |
3 files changed, 73 insertions, 102 deletions
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index 91c4db7b4221..28beaf4e23b1 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -739,7 +739,7 @@ void X11SalGraphicsImpl::drawMaskedBitmap( const SalTwoRect& rPosAry, // bitdepth to create pixmaps for, otherwise, XCopyArea will // refuse to work. const sal_uInt16 nDepth( mrParent.m_pVDev ? - mrParent.m_pVDev->GetDepth() : + static_cast< X11SalVirtualDevice* >(mrParent.m_pVDev)->GetDepth() : pSalDisp->GetVisual( mrParent.m_nXScreen ).GetDepth() ); Pixmap aFG( limitXCreatePixmap( pXDisp, aDrawable, rPosAry.mnDestWidth, rPosAry.mnDestHeight, nDepth ) ); @@ -861,7 +861,7 @@ bool X11SalGraphicsImpl::drawAlphaBitmap( const SalTwoRect& rTR, Display* pXDisplay = pSalDisp->GetDisplay(); // create source Picture - int nDepth = mrParent.m_pVDev ? mrParent.m_pVDev->GetDepth() : rSalVis.GetDepth(); + int nDepth = mrParent.m_pVDev ? static_cast< X11SalVirtualDevice* >(mrParent.m_pVDev)->GetDepth() : rSalVis.GetDepth(); const X11SalBitmap& rSrcX11Bmp = static_cast<const X11SalBitmap&>( rSrcBitmap ); ImplSalDDB* pSrcDDB = rSrcX11Bmp.ImplGetDDB( mrParent.hDrawable_, mrParent.m_nXScreen, nDepth, rTR ); if( !pSrcDDB ) @@ -988,7 +988,7 @@ bool X11SalGraphicsImpl::drawAlphaRect( long nX, long nY, long nWidth, if( mbPenGC || !mbBrushGC || mbXORMode ) return false; // can only perform solid fills without XOR. - if( mrParent.m_pVDev && mrParent.m_pVDev->GetDepth() < 8 ) + if( mrParent.m_pVDev && static_cast< X11SalVirtualDevice* >(mrParent.m_pVDev)->GetDepth() < 8 ) return false; Picture aDstPic = GetXRenderPicture(); @@ -1575,7 +1575,7 @@ long X11SalGraphicsImpl::GetGraphicsHeight() const if( mrParent.m_pFrame ) return mrParent.m_pFrame->maGeometry.nHeight; else if( mrParent.m_pVDev ) - return mrParent.m_pVDev->GetHeight(); + return static_cast< X11SalVirtualDevice* >(mrParent.m_pVDev)->GetHeight(); else return 0; } @@ -1849,7 +1849,7 @@ long X11SalGraphicsImpl::GetGraphicsWidth() const if( mrParent.m_pFrame ) return mrParent.m_pFrame->maGeometry.nWidth; else if( mrParent.m_pVDev ) - return mrParent.m_pVDev->GetWidth(); + return static_cast< X11SalVirtualDevice* >(mrParent.m_pVDev)->GetWidth(); else return 0; } diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index 3c1a7279c421..d9eb7df2cf74 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -148,11 +148,7 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, SalX11Screen nXScreen ) m_aXRenderPicture = 0; } - if( hDrawable_ ) - { - mpImpl->Init(); - // TODO: moggi: FIXME nTextPixel_ = GetPixel( nTextColor_ ); - } + // TODO: moggi: FIXME nTextPixel_ = GetPixel( nTextColor_ ); } void X11SalGraphics::Init( SalFrame *pFrame, Drawable aTarget, @@ -160,11 +156,15 @@ void X11SalGraphics::Init( SalFrame *pFrame, Drawable aTarget, { m_pColormap = &GetGenericData()->GetSalDisplay()->GetColormap(nXScreen); m_nXScreen = nXScreen; + m_pFrame = pFrame; - SetDrawable( aTarget, nXScreen ); + m_pVDev = NULL; bWindow_ = true; - m_pVDev = NULL; + bVirDev_ = false; + + SetDrawable( aTarget, nXScreen ); + mpImpl->Init(); } void X11SalGraphics::DeInit() diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index 71ec509d1a2b..7967a4d84acf 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -32,49 +32,17 @@ #include <salinst.hxx> +#include <vcl/opengl/OpenGLHelper.hxx> +#include <opengl/x11/salvd.hxx> + SalVirtualDevice* X11SalInstance::CreateVirtualDevice( SalGraphics* pGraphics, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) { - X11SalVirtualDevice *pVDev = new X11SalVirtualDevice(); - if( !nBitCount && pGraphics ) - nBitCount = pGraphics->GetBitCount(); - - if( pData && pData->hDrawable != None ) - { - ::Window aRoot; - int x, y; - unsigned int w = 0, h = 0, bw, d; - Display* pDisp = GetGenericData()->GetSalDisplay()->GetDisplay(); - XGetGeometry( pDisp, pData->hDrawable, - &aRoot, &x, &y, &w, &h, &bw, &d ); - int nScreen = 0; - while( nScreen < ScreenCount( pDisp ) ) - { - if( RootWindow( pDisp, nScreen ) == aRoot ) - break; - nScreen++; - } - nDX = (long)w; - nDY = (long)h; - if( !pVDev->Init( GetGenericData()->GetSalDisplay(), nDX, nDY, nBitCount, - SalX11Screen( nScreen ), pData->hDrawable, - static_cast< XRenderPictFormat* >( pData->pXRenderFormat )) ) - { - delete pVDev; - return NULL; - } - } - else if( !pVDev->Init( GetGenericData()->GetSalDisplay(), nDX, nDY, nBitCount, - pGraphics ? static_cast<X11SalGraphics*>(pGraphics)->GetScreenNumber() : - GetGenericData()->GetSalDisplay()->GetDefaultXScreen() ) ) - { - delete pVDev; - return NULL; - } - - pVDev->InitGraphics( pVDev ); - return pVDev; + if (OpenGLHelper::isVCLOpenGLEnabled()) + return new X11OpenGLSalVirtualDevice( pGraphics, nDX, nDY, nBitCount, pData ); + else + return new X11SalVirtualDevice( pGraphics, nDX, nDY, nBitCount, pData ); } void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, SalColormap* pColormap, @@ -110,66 +78,78 @@ void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, SalColormap* pColormap, const Drawable aVdevDrawable = pDevice->GetDrawable(); SetDrawable( aVdevDrawable, m_nXScreen ); + mpImpl->Init(); } -bool X11SalVirtualDevice::Init( SalDisplay *pDisplay, - long nDX, long nDY, - sal_uInt16 nBitCount, - SalX11Screen nXScreen, - Pixmap hDrawable, - XRenderPictFormat* pXRenderFormat ) +X11SalVirtualDevice::X11SalVirtualDevice( SalGraphics* pGraphics, + long nDX, long nDY, + sal_uInt16 nBitCount, + const SystemGraphicsData *pData ) : + m_nXScreen( 0 ), + bGraphics_( false ) { SalColormap* pColormap = NULL; bool bDeleteColormap = false; - pDisplay_ = pDisplay; + if( !nBitCount && pGraphics ) + nBitCount = pGraphics->GetBitCount(); + + pDisplay_ = GetGenericData()->GetSalDisplay(); pGraphics_ = new X11SalGraphics(); - m_nXScreen = nXScreen; - if( pXRenderFormat ) { + nDepth_ = nBitCount; + + if( pData && pData->hDrawable != None ) + { + ::Window aRoot; + int x, y; + unsigned int w = 0, h = 0, bw, d; + Display* pDisp = pDisplay_->GetDisplay(); + XGetGeometry( pDisp, pData->hDrawable, + &aRoot, &x, &y, &w, &h, &bw, &d ); + int nScreen = 0; + while( nScreen < ScreenCount( pDisp ) ) + { + if( RootWindow( pDisp, nScreen ) == aRoot ) + break; + nScreen++; + } + nDX_ = (long)w; + nDY_ = (long)h; + m_nXScreen = SalX11Screen( nScreen ); + hDrawable_ = pData->hDrawable; + bExternPixmap_ = true; + } + else + { + nDX_ = nDX; + nDY_ = nDY; + m_nXScreen = pGraphics ? static_cast<X11SalGraphics*>(pGraphics)->GetScreenNumber() : + GetGenericData()->GetSalDisplay()->GetDefaultXScreen(); + hDrawable_ = limitXCreatePixmap( GetXDisplay(), + pDisplay_->GetDrawable( m_nXScreen ), + nDX_, nDY_, + GetDepth() ); + bExternPixmap_ = false; + } + + XRenderPictFormat* pXRenderFormat = pData ? static_cast<XRenderPictFormat*>(pData->pXRenderFormat) : NULL; + if( pXRenderFormat ) + { pGraphics_->SetXRenderFormat( pXRenderFormat ); if( pXRenderFormat->colormap ) - pColormap = new SalColormap( pDisplay, pXRenderFormat->colormap, m_nXScreen ); + pColormap = new SalColormap( pDisplay_, pXRenderFormat->colormap, m_nXScreen ); else pColormap = new SalColormap( nBitCount ); bDeleteColormap = true; } - else if( nBitCount != pDisplay->GetVisual( m_nXScreen ).GetDepth() ) + else if( nBitCount != pDisplay_->GetVisual( m_nXScreen ).GetDepth() ) { pColormap = new SalColormap( nBitCount ); bDeleteColormap = true; } - pGraphics_->SetLayout( 0 ); // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL() - nDX_ = nDX; - nDY_ = nDY; - nDepth_ = nBitCount; - - if( hDrawable == None ) - hDrawable_ = limitXCreatePixmap( GetXDisplay(), - pDisplay_->GetDrawable( m_nXScreen ), - nDX_, nDY_, - GetDepth() ); - else - { - hDrawable_ = hDrawable; - bExternPixmap_ = true; - } + pGraphics_->SetLayout( 0 ); // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL() pGraphics_->Init( this, pColormap, bDeleteColormap ); - - return hDrawable_ != None; -} - -X11SalVirtualDevice::X11SalVirtualDevice() : - m_nXScreen( 0 ) -{ - pDisplay_ = NULL; - pGraphics_ = NULL; - hDrawable_ = None; - nDX_ = 0; - nDY_ = 0; - nDepth_ = 0; - bGraphics_ = false; - bExternPixmap_ = false; } X11SalVirtualDevice::~X11SalVirtualDevice() @@ -196,8 +176,6 @@ SalGraphics* X11SalVirtualDevice::AcquireGraphics() void X11SalVirtualDevice::ReleaseGraphics( SalGraphics* ) { bGraphics_ = false; } -#include "opengl/x11/gdiimpl.hxx" - bool X11SalVirtualDevice::SetSize( long nDX, long nDY ) { if( bExternPixmap_ ) @@ -231,14 +209,7 @@ bool X11SalVirtualDevice::SetSize( long nDX, long nDY ) nDY_ = nDY; if( pGraphics_ ) - { - InitGraphics( this ); - - // re-initialize OpenGLContext [!] having freed it's underlying pixmap above - X11OpenGLSalGraphicsImpl *pImpl = dynamic_cast< X11OpenGLSalGraphicsImpl* >(pGraphics_->GetImpl()); - if( pImpl ) - pImpl->Init(); - } + pGraphics_->Init( this ); return true; } |