summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2014-04-25 02:23:22 +1000
committerChris Sherlock <chris.sherlock79@gmail.com>2014-04-25 02:35:57 +1000
commit95711f5b9e7b6a982d1762d37d5a38e0f40b86f9 (patch)
tree9ccb32dbd8088eaad7b5c1dbd466a056e6f8fc54
parent07ed9492cc73c5328f1d4fb43bfa9ada17d1ad2c (diff)
fdo#74702 Move ImplInitClipRegion Window code out of OutputDevice
Window instances need to handle overlapped window clipping, VirtualDevice and Printer do not have to worry about this. This code should be kept in the class that handles it, so I'm seperating it out. Change-Id: Ie7df90c983f7a858b563d4f892ceb64d575c0319
-rw-r--r--include/vcl/outdev.hxx4
-rw-r--r--include/vcl/window.hxx2
-rw-r--r--vcl/source/outdev/clipping.cxx96
-rw-r--r--vcl/source/window/window.cxx33
4 files changed, 70 insertions, 65 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index dbed1f08a455..115e9535e7f3 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -455,10 +455,12 @@ public:
*/
///@{
- SAL_DLLPRIVATE void ImplInitClipRegion();
SAL_DLLPRIVATE bool ImplSelectClipRegion( const Region&, SalGraphics* pGraphics = NULL );
SAL_DLLPRIVATE void ImplSetClipRegion( const Region* pRegion );
+protected:
+ virtual void ImplInitClipRegion();
+
///@}
public:
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 39f9357aaf9d..928aa2a91f00 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -567,6 +567,8 @@ protected:
virtual bool AcquireGraphics() const SAL_OVERRIDE;
virtual void ReleaseGraphics( bool bRelease = true ) SAL_OVERRIDE;
+ virtual void ImplInitClipRegion() SAL_OVERRIDE;
+
// FIXME: this is a hack to workaround missing layout functionality
SAL_DLLPRIVATE void ImplAdjustNWFSizes();
diff --git a/vcl/source/outdev/clipping.cxx b/vcl/source/outdev/clipping.cxx
index 48253c5d31c0..cc976b06b22c 100644
--- a/vcl/source/outdev/clipping.cxx
+++ b/vcl/source/outdev/clipping.cxx
@@ -58,83 +58,51 @@ void OutputDevice::ImplInitClipRegion()
{
DBG_TESTSOLARMUTEX();
- if ( GetOutDevType() == OUTDEV_WINDOW )
+ if ( mbClipRegion )
{
- 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() )
+ if ( maRegion.IsEmpty() )
mbOutputClipped = true;
else
{
mbOutputClipped = false;
- ImplSelectClipRegion( aRegion );
- }
- mbClipRegionSet = true;
- }
- else
- {
- if ( mbClipRegion )
- {
- if ( maRegion.IsEmpty() )
+
+ // #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;
-
- // #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 );
- }
+ ImplSelectClipRegion( aRegion );
}
-
- mbClipRegionSet = true;
}
- else
- {
- if ( mbClipRegionSet )
- {
- mpGraphics->ResetClipRegion();
- mbClipRegionSet = false;
- }
- mbOutputClipped = false;
+ mbClipRegionSet = true;
+ }
+ else
+ {
+ if ( mbClipRegionSet )
+ {
+ mpGraphics->ResetClipRegion();
+ mbClipRegionSet = false;
}
+
+ mbOutputClipped = false;
}
mbInitClipRegion = false;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index cf53f2ae3bff..9fe3df56c1b7 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -406,6 +406,39 @@ bool Window::AcquireGraphics() const
return mpGraphics ? true : false;
}
+void Window::ImplInitClipRegion()
+{
+ DBG_TESTSOLARMUTEX();
+
+ Region aRegion;
+
+ // Put back backed up background
+ if ( mpWindowImpl->mpFrameData->mpFirstBackWin )
+ ImplInvalidateAllOverlapBackgrounds();
+ if ( mpWindowImpl->mbInPaint )
+ aRegion = *(mpWindowImpl->mpPaintRegion);
+ else
+ {
+ aRegion = *(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;
+
+ mbInitClipRegion = false;
+}
+
void Window::EnableRTL ( bool bEnable )
{
StateChanged( STATE_CHANGE_MIRRORING );