diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-25 03:42:13 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-25 03:42:13 +1000 |
commit | 7b4c2f7f5a5b801bd3264000c19821b8dea1e14f (patch) | |
tree | af4f9d45467fc8e64f14a2f89b437db286da27bc /vcl/source | |
parent | b3b0331711a1cab740d6c2220ef766f611a117b8 (diff) |
Rearrange function locations in outdev.hxx and outdev/clipping.cxx
Change-Id: Idb1faf5632da8ea3fec674f9fb2d042c7ff14fa7
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/outdev/clipping.cxx | 198 |
1 files changed, 100 insertions, 98 deletions
diff --git a/vcl/source/outdev/clipping.cxx b/vcl/source/outdev/clipping.cxx index a7d2ea761e84..f19a084fe483 100644 --- a/vcl/source/outdev/clipping.cxx +++ b/vcl/source/outdev/clipping.cxx @@ -31,100 +31,10 @@ #include <numeric> -void OutputDevice::InitClipRegion() -{ - DBG_TESTSOLARMUTEX(); - - 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; - SelectClipRegion( aRegion ); - } - } - - mbClipRegionSet = true; - } - else - { - if ( mbClipRegionSet ) - { - mpGraphics->ResetClipRegion(); - mbClipRegionSet = false; - } - - mbOutputClipped = false; - } - - mbInitClipRegion = false; -} - -void OutputDevice::ClipToPaintRegion(Rectangle& /*rDstRect*/) -{ -} - -bool OutputDevice::SelectClipRegion( const Region& rRegion, SalGraphics* pGraphics ) -{ - DBG_TESTSOLARMUTEX(); - - if( !pGraphics ) - { - if( !mpGraphics ) - if( !AcquireGraphics() ) - return false; - pGraphics = mpGraphics; - } - - bool bClipRegion = pGraphics->SetClipRegion( rRegion, this ); - OSL_ENSURE( bClipRegion, "OutputDevice::SelectClipRegion() - can't create region" ); - return bClipRegion; -} - -void OutputDevice::SetDeviceClipRegion( const Region* pRegion ) +Region OutputDevice::GetClipRegion() const { - DBG_TESTSOLARMUTEX(); - if ( !pRegion ) - { - if ( mbClipRegion ) - { - maRegion = Region(true); - mbClipRegion = false; - mbInitClipRegion = true; - } - } - else - { - maRegion = *pRegion; - mbClipRegion = true; - mbInitClipRegion = true; - } + return PixelToLogic( maRegion ); } void OutputDevice::SetClipRegion() @@ -159,15 +69,21 @@ void OutputDevice::SetClipRegion( const Region& rRegion ) mpAlphaVDev->SetClipRegion( rRegion ); } -Region OutputDevice::GetClipRegion() const +bool OutputDevice::SelectClipRegion( const Region& rRegion, SalGraphics* pGraphics ) { + DBG_TESTSOLARMUTEX(); - return PixelToLogic( maRegion ); -} + if( !pGraphics ) + { + if( !mpGraphics ) + if( !AcquireGraphics() ) + return false; + pGraphics = mpGraphics; + } -Region OutputDevice::GetActiveClipRegion() const -{ - return GetClipRegion(); + bool bClipRegion = pGraphics->SetClipRegion( rRegion, this ); + OSL_ENSURE( bClipRegion, "OutputDevice::SelectClipRegion() - can't create region" ); + return bClipRegion; } void OutputDevice::MoveClipRegion( long nHorzMove, long nVertMove ) @@ -220,4 +136,90 @@ void OutputDevice::IntersectClipRegion( const Region& rRegion ) mpAlphaVDev->IntersectClipRegion( rRegion ); } +void OutputDevice::InitClipRegion() +{ + DBG_TESTSOLARMUTEX(); + + 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; + SelectClipRegion( aRegion ); + } + } + + mbClipRegionSet = true; + } + else + { + if ( mbClipRegionSet ) + { + mpGraphics->ResetClipRegion(); + mbClipRegionSet = false; + } + + mbOutputClipped = false; + } + + mbInitClipRegion = false; +} + +Region OutputDevice::GetActiveClipRegion() const +{ + return GetClipRegion(); +} + +void OutputDevice::ClipToPaintRegion(Rectangle& /*rDstRect*/) +{ + // this is only used in Window, but we still need it as it's called + // on in other clipping functions +} + +void OutputDevice::SetDeviceClipRegion( const Region* pRegion ) +{ + DBG_TESTSOLARMUTEX(); + + if ( !pRegion ) + { + if ( mbClipRegion ) + { + maRegion = Region(true); + mbClipRegion = false; + mbInitClipRegion = true; + } + } + else + { + maRegion = *pRegion; + mbClipRegion = true; + mbInitClipRegion = true; + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |