diff options
Diffstat (limited to 'vcl/win/source')
-rwxr-xr-x | vcl/win/source/gdi/salgdi.cxx | 217 | ||||
-rwxr-xr-x | vcl/win/source/gdi/salgdi2.cxx | 3 | ||||
-rwxr-xr-x | vcl/win/source/gdi/salprn.cxx | 9 | ||||
-rwxr-xr-x | vcl/win/source/window/salframe.cxx | 7 |
4 files changed, 134 insertions, 102 deletions
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index 18fda5a97007..bc2f8ade3ccc 100755 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -37,11 +37,16 @@ #include <tools/debug.hxx> #include <tools/poly.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> + #include <win/wincomp.hxx> #include <win/saldata.hxx> #include <win/salgdi.h> #include <win/salframe.h> +#include <region.h> + using namespace rtl; // ======================================================================= @@ -541,7 +546,9 @@ void ImplSalInitGraphics( WinSalGraphics* pData ) void ImplSalDeInitGraphics( WinSalGraphics* pData ) { - // Default Objekte selektieren + // clear clip region + SelectClipRgn( pData->mhDC, 0 ); + // select default objects if ( pData->mhDefPen ) SelectPen( pData->mhDC, pData->mhDefPen ); if ( pData->mhDefBrush ) @@ -850,7 +857,7 @@ void WinSalGraphics::ResetClipRegion() // ----------------------------------------------------------------------- -void WinSalGraphics::BeginSetClipRegion( sal_uLong nRectCount ) +bool WinSalGraphics::setClipRegion( const Region& i_rClip ) { if ( mhRegion ) { @@ -858,123 +865,143 @@ void WinSalGraphics::BeginSetClipRegion( sal_uLong nRectCount ) mhRegion = 0; } - sal_uLong nRectBufSize = sizeof(RECT)*nRectCount; - if ( nRectCount < SAL_CLIPRECT_COUNT ) + if( i_rClip.HasPolyPolygon() ) { - if ( !mpStdClipRgnData ) - mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))]; - mpClipRgnData = mpStdClipRgnData; + // TODO: ConvertToB2DPolyPolygon actually is kind of const, just it does not advertise it in the header + basegfx::B2DPolyPolygon aPolyPolygon( const_cast<Region&>(i_rClip).ConvertToB2DPolyPolygon() ); + const sal_uInt32 nCount(aPolyPolygon.count()); + + if( nCount ) + { + std::vector< POINT > aPolyPoints; + aPolyPoints.reserve( 1024 ); + std::vector< INT > aPolyCounts( nCount, 0 ); + for(sal_uInt32 a(0); a < nCount; a++) + { + basegfx::B2DPolygon aPoly( aPolyPolygon.getB2DPolygon(a) ); + aPoly = basegfx::tools::adaptiveSubdivideByDistance( aPoly, 1 ); + const sal_uInt32 nPoints = aPoly.count(); + aPolyCounts[a] = nPoints; + for( sal_uInt32 b = 0; b < nPoints; b++ ) + { + basegfx::B2DPoint aPt( aPoly.getB2DPoint( b ) ); + POINT aPOINT; + aPOINT.x = (LONG)aPt.getX(); + aPOINT.y = (LONG)aPt.getY(); + aPolyPoints.push_back( aPOINT ); + } + } + mhRegion = CreatePolyPolygonRgn( &aPolyPoints[0], &aPolyCounts[0], nCount, ALTERNATE ); + } } else - mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize]; - mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER ); - mpClipRgnData->rdh.iType = RDH_RECTANGLES; - mpClipRgnData->rdh.nCount = nRectCount; - mpClipRgnData->rdh.nRgnSize = nRectBufSize; - SetRectEmpty( &(mpClipRgnData->rdh.rcBound) ); - mpNextClipRect = (RECT*)(&(mpClipRgnData->Buffer)); - mbFirstClipRect = TRUE; -} - - -// ----------------------------------------------------------------------- - -sal_Bool WinSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - if ( nWidth && nHeight ) { - RECT* pRect = mpNextClipRect; - RECT* pBoundRect = &(mpClipRgnData->rdh.rcBound); - long nRight = nX + nWidth; - long nBottom = nY + nHeight; + ULONG nRectCount = i_rClip.GetRectCount(); - if ( mbFirstClipRect ) + ULONG nRectBufSize = sizeof(RECT)*nRectCount; + if ( nRectCount < SAL_CLIPRECT_COUNT ) { - pBoundRect->left = nX; - pBoundRect->top = nY; - pBoundRect->right = nRight; - pBoundRect->bottom = nBottom; - mbFirstClipRect = FALSE; + if ( !mpStdClipRgnData ) + mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))]; + mpClipRgnData = mpStdClipRgnData; } else + mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize]; + mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER ); + mpClipRgnData->rdh.iType = RDH_RECTANGLES; + mpClipRgnData->rdh.nCount = nRectCount; + mpClipRgnData->rdh.nRgnSize = nRectBufSize; + RECT* pBoundRect = &(mpClipRgnData->rdh.rcBound); + SetRectEmpty( pBoundRect ); + RECT* pNextClipRect = (RECT*)(&(mpClipRgnData->Buffer)); + bool bFirstClipRect = true; + + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) { - if ( nX < pBoundRect->left ) - pBoundRect->left = (int)nX; - - if ( nY < pBoundRect->top ) - pBoundRect->top = (int)nY; - - if ( nRight > pBoundRect->right ) - pBoundRect->right = (int)nRight; - - if ( nBottom > pBoundRect->bottom ) - pBoundRect->bottom = (int)nBottom; - } - - pRect->left = (int)nX; - pRect->top = (int)nY; - pRect->right = (int)nRight; - pRect->bottom = (int)nBottom; - mpNextClipRect++; - } - else - { - mpClipRgnData->rdh.nCount--; - mpClipRgnData->rdh.nRgnSize -= sizeof( RECT ); - } - - return TRUE; -} + if ( nW && nH ) + { + long nRight = nX + nW; + long nBottom = nY + nH; -// ----------------------------------------------------------------------- + if ( bFirstClipRect ) + { + pBoundRect->left = nX; + pBoundRect->top = nY; + pBoundRect->right = nRight; + pBoundRect->bottom = nBottom; + bFirstClipRect = false; + } + else + { + if ( nX < pBoundRect->left ) + pBoundRect->left = (int)nX; -bool WinSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} + if ( nY < pBoundRect->top ) + pBoundRect->top = (int)nY; -// ----------------------------------------------------------------------- + if ( nRight > pBoundRect->right ) + pBoundRect->right = (int)nRight; -void WinSalGraphics::EndSetClipRegion() -{ - // create clip region from ClipRgnData - if ( mpClipRgnData->rdh.nCount == 1 ) - { - RECT* pRect = &(mpClipRgnData->rdh.rcBound); - mhRegion = CreateRectRgn( pRect->left, pRect->top, - pRect->right, pRect->bottom ); - } - else - { - sal_uLong nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); - mhRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData ); + if ( nBottom > pBoundRect->bottom ) + pBoundRect->bottom = (int)nBottom; + } - // if ExtCreateRegion(...) is not supported - if( !mhRegion ) + pNextClipRect->left = (int)nX; + pNextClipRect->top = (int)nY; + pNextClipRect->right = (int)nRight; + pNextClipRect->bottom = (int)nBottom; + pNextClipRect++; + } + else + { + mpClipRgnData->rdh.nCount--; + mpClipRgnData->rdh.nRgnSize -= sizeof( RECT ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } + // create clip region from ClipRgnData + if ( mpClipRgnData->rdh.nCount == 1 ) { - RGNDATAHEADER* pHeader = (RGNDATAHEADER*) mpClipRgnData; + RECT* pRect = &(mpClipRgnData->rdh.rcBound); + mhRegion = CreateRectRgn( pRect->left, pRect->top, + pRect->right, pRect->bottom ); + } + else if( mpClipRgnData->rdh.nCount > 1 ) + { + ULONG nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); + mhRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData ); - if( pHeader->nCount ) + // if ExtCreateRegion(...) is not supported + if( !mhRegion ) { - RECT* pRect = (RECT*) mpClipRgnData->Buffer; - mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); - pRect++; + RGNDATAHEADER* pHeader = (RGNDATAHEADER*) mpClipRgnData; - for( sal_uLong n = 1; n < pHeader->nCount; n++, pRect++ ) + if( pHeader->nCount ) { - HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); - CombineRgn( mhRegion, mhRegion, hRgn, RGN_OR ); - DeleteRegion( hRgn ); + RECT* pRect = (RECT*) mpClipRgnData->Buffer; + mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); + pRect++; + + for( ULONG n = 1; n < pHeader->nCount; n++, pRect++ ) + { + HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); + CombineRgn( mhRegion, mhRegion, hRgn, RGN_OR ); + DeleteRegion( hRgn ); + } } } - } - if ( mpClipRgnData != mpStdClipRgnData ) - delete [] mpClipRgnData; + if ( mpClipRgnData != mpStdClipRgnData ) + delete [] mpClipRgnData; + } } - SelectClipRgn( mhDC, mhRegion ); + if( mhRegion ) + SelectClipRgn( mhDC, mhRegion ); + return mhRegion != 0; } // ----------------------------------------------------------------------- diff --git a/vcl/win/source/gdi/salgdi2.cxx b/vcl/win/source/gdi/salgdi2.cxx index 3043593d7dd9..5ac117a596d9 100755 --- a/vcl/win/source/gdi/salgdi2.cxx +++ b/vcl/win/source/gdi/salgdi2.cxx @@ -51,6 +51,9 @@ bool WinSalGraphics::supportsOperation( OutDevSupportType eType ) const case OutDevSupport_TransparentRect: bRet = mbVirDev || mbWindow; break; + case OutDevSupport_B2DClip: + bRet = true; + break; case OutDevSupport_B2DDraw: bRet = bAllowForTest; default: break; diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index e0a82869a763..263d06670584 100755 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -93,6 +93,7 @@ #endif +using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::ui::dialogs; @@ -2084,16 +2085,16 @@ sal_Bool WinSalPrinter::StartJob( const XubString* pFileName, if( mpInfoPrinter->maPortName.EqualsIgnoreCaseAscii( "FILE:" ) && !(pFileName && pFileName->Len()) ) { - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); if( xFactory.is() ) { - Reference< XFilePicker > xFilePicker( xFactory->createInstance( + uno::Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY ); DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" ); - Reference< XInitialization > xInit( xFilePicker, UNO_QUERY ); - Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY ); + uno::Reference< XInitialization > xInit( xFilePicker, UNO_QUERY ); + uno::Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY ); if( xInit.is() && xFilePicker.is() && xFilterMgr.is() ) { Sequence< Any > aServiceType( 1 ); diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index d66a17ac1fe6..bcbaee6d8b6c 100755 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -101,6 +101,7 @@ using ::std::max; #include <time.h> using ::rtl::OUString; +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; @@ -872,11 +873,11 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame, try { - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); + uno::Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + uno::Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); if( (pFrame->mnDisplay >= 0) && (pFrame->mnDisplay < xMultiMon->getCount()) ) { - Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( pFrame->mnDisplay ), UNO_QUERY_THROW ); + uno::Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( pFrame->mnDisplay ), UNO_QUERY_THROW ); com::sun::star::awt::Rectangle aRect; if( xMonitor->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ScreenArea" ) ) ) >>= aRect ) { |