diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-22 02:21:05 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-22 02:30:40 +1000 |
commit | 67d4ad765c560e932400624d611801b40de6a562 (patch) | |
tree | 75cc9da2d819e0849afda30c0b118ce7d58ccfb0 /vcl | |
parent | 0347aecfc7bb72db1d4feb90d8323012cd1ae521 (diff) |
Move OutputDevice clipping functions into own file
Change-Id: Id1bfa4c6db202597107de3047326fe1bd17f2387
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/Library_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/source/outdev/outdev.cxx | 238 |
2 files changed, 1 insertions, 238 deletions
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 8a6cb5c8d15e..8ecfb696a196 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -235,6 +235,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/gdi/octree \ vcl/source/gdi/oldprintadaptor \ vcl/source/outdev/outdev \ + vcl/source/outdev/clipping \ vcl/source/outdev/tworect \ vcl/source/outdev/polygon \ vcl/source/outdev/transparent \ diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 032ed0376dfd..1658b7e0dabe 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -175,27 +175,6 @@ bool OutputDevice::ImplIsAntiparallel() const return bRet; } -void OutputDevice::ClipToPaintRegion(Rectangle& /*rDstRect*/) -{ -} - -bool OutputDevice::ImplSelectClipRegion( const Region& rRegion, SalGraphics* pGraphics ) -{ - DBG_TESTSOLARMUTEX(); - - if( !pGraphics ) - { - if( !mpGraphics ) - if( !ImplInitGraphics() ) - return false; - pGraphics = mpGraphics; - } - - bool bClipRegion = pGraphics->SetClipRegion( rRegion, this ); - OSL_ENSURE( bClipRegion, "OutputDevice::ImplSelectClipRegion() - can't create region" ); - return bClipRegion; -} - OutputDevice::OutputDevice() : maRegion(true), maFillColor( COL_WHITE ), @@ -802,223 +781,6 @@ void OutputDevice::ImplInitFillColor() mbInitFillColor = false; } -// TODO: fdo#74424 - this needs to be moved out of OutputDevice and into the -// Window, VirtualDevice and Printer classes -void OutputDevice::ImplInitClipRegion() -{ - DBG_TESTSOLARMUTEX(); - - if ( GetOutDevType() == OUTDEV_WINDOW ) - { - Window* pWindow = (Window*)this; - Region aRegion; - - // Put back backed up background - if ( pWindow->mpWindowImpl->mpFrameData->mpFirstBackWin ) - pWindow->ImplInvalidateAllOverlapBackgrounds(); - if ( pWindow->mpWindowImpl->mbInPaint ) - aRegion = *(pWindow->mpWindowImpl->mpPaintRegion); - else - { - aRegion = *(pWindow->ImplGetWinChildClipRegion()); - // --- RTL -- only this region is in frame coordinates, so re-mirror it - // the mpWindowImpl->mpPaintRegion above is already correct (see ImplCallPaint()) ! - if( ImplIsAntiparallel() ) - ReMirror ( aRegion ); - } - if ( mbClipRegion ) - aRegion.Intersect( ImplPixelToDevicePixel( maRegion ) ); - if ( aRegion.IsEmpty() ) - mbOutputClipped = true; - else - { - mbOutputClipped = false; - ImplSelectClipRegion( aRegion ); - } - mbClipRegionSet = true; - } - else - { - if ( mbClipRegion ) - { - if ( maRegion.IsEmpty() ) - mbOutputClipped = true; - else - { - mbOutputClipped = false; - - // #102532# Respect output offset also for clip region - Region aRegion( ImplPixelToDevicePixel( maRegion ) ); - const bool bClipDeviceBounds( ! GetPDFWriter() - && GetOutDevType() != OUTDEV_PRINTER ); - if( bClipDeviceBounds ) - { - // Perform actual rect clip against outdev - // dimensions, to generate empty clips whenever one of the - // values is completely off the device. - Rectangle aDeviceBounds( mnOutOffX, mnOutOffY, - mnOutOffX+GetOutputWidthPixel()-1, - mnOutOffY+GetOutputHeightPixel()-1 ); - aRegion.Intersect( aDeviceBounds ); - } - - if ( aRegion.IsEmpty() ) - { - mbOutputClipped = true; - } - else - { - mbOutputClipped = false; - ImplSelectClipRegion( aRegion ); - } - } - - mbClipRegionSet = true; - } - else - { - if ( mbClipRegionSet ) - { - mpGraphics->ResetClipRegion(); - mbClipRegionSet = false; - } - - mbOutputClipped = false; - } - } - - mbInitClipRegion = false; -} - -void OutputDevice::ImplSetClipRegion( const Region* pRegion ) -{ - DBG_TESTSOLARMUTEX(); - - if ( !pRegion ) - { - if ( mbClipRegion ) - { - maRegion = Region(true); - mbClipRegion = false; - mbInitClipRegion = true; - } - } - else - { - maRegion = *pRegion; - mbClipRegion = true; - mbInitClipRegion = true; - } -} - -void OutputDevice::SetClipRegion() -{ - - if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaClipRegionAction( Region(), false ) ); - - ImplSetClipRegion( NULL ); - - if( mpAlphaVDev ) - mpAlphaVDev->SetClipRegion(); -} - -void OutputDevice::SetClipRegion( const Region& rRegion ) -{ - - if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaClipRegionAction( rRegion, true ) ); - - if ( rRegion.IsNull() ) - { - ImplSetClipRegion( NULL ); - } - else - { - Region aRegion = LogicToPixel( rRegion ); - ImplSetClipRegion( &aRegion ); - } - - if( mpAlphaVDev ) - mpAlphaVDev->SetClipRegion( rRegion ); -} - -Region OutputDevice::GetClipRegion() const -{ - - return PixelToLogic( maRegion ); -} - -Region OutputDevice::GetActiveClipRegion() const -{ - - if ( GetOutDevType() == OUTDEV_WINDOW ) - { - Region aRegion(true); - Window* pWindow = (Window*)this; - if ( pWindow->mpWindowImpl->mbInPaint ) - { - aRegion = *(pWindow->mpWindowImpl->mpPaintRegion); - aRegion.Move( -mnOutOffX, -mnOutOffY ); - } - if ( mbClipRegion ) - aRegion.Intersect( maRegion ); - return PixelToLogic( aRegion ); - } - else - return GetClipRegion(); -} - -void OutputDevice::MoveClipRegion( long nHorzMove, long nVertMove ) -{ - - if ( mbClipRegion ) - { - if( mpMetaFile ) - mpMetaFile->AddAction( new MetaMoveClipRegionAction( nHorzMove, nVertMove ) ); - - maRegion.Move( ImplLogicWidthToDevicePixel( nHorzMove ), - ImplLogicHeightToDevicePixel( nVertMove ) ); - mbInitClipRegion = true; - } - - if( mpAlphaVDev ) - mpAlphaVDev->MoveClipRegion( nHorzMove, nVertMove ); -} - -void OutputDevice::IntersectClipRegion( const Rectangle& rRect ) -{ - - if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaISectRectClipRegionAction( rRect ) ); - - Rectangle aRect = LogicToPixel( rRect ); - maRegion.Intersect( aRect ); - mbClipRegion = true; - mbInitClipRegion = true; - - if( mpAlphaVDev ) - mpAlphaVDev->IntersectClipRegion( rRect ); -} - -void OutputDevice::IntersectClipRegion( const Region& rRegion ) -{ - - if(!rRegion.IsNull()) - { - if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaISectRegionClipRegionAction( rRegion ) ); - - Region aRegion = LogicToPixel( rRegion ); - maRegion.Intersect( aRegion ); - mbClipRegion = true; - mbInitClipRegion = true; - } - - if( mpAlphaVDev ) - mpAlphaVDev->IntersectClipRegion( rRegion ); -} - void OutputDevice::SetDrawMode( sal_uLong nDrawMode ) { |