Kaydet (Commit) 95711f5b authored tarafından Chris Sherlock's avatar Chris Sherlock

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
üst 07ed9492
...@@ -455,10 +455,12 @@ public: ...@@ -455,10 +455,12 @@ public:
*/ */
///@{ ///@{
SAL_DLLPRIVATE void ImplInitClipRegion();
SAL_DLLPRIVATE bool ImplSelectClipRegion( const Region&, SalGraphics* pGraphics = NULL ); SAL_DLLPRIVATE bool ImplSelectClipRegion( const Region&, SalGraphics* pGraphics = NULL );
SAL_DLLPRIVATE void ImplSetClipRegion( const Region* pRegion ); SAL_DLLPRIVATE void ImplSetClipRegion( const Region* pRegion );
protected:
virtual void ImplInitClipRegion();
///@} ///@}
public: public:
......
...@@ -567,6 +567,8 @@ protected: ...@@ -567,6 +567,8 @@ protected:
virtual bool AcquireGraphics() const SAL_OVERRIDE; virtual bool AcquireGraphics() const SAL_OVERRIDE;
virtual void ReleaseGraphics( bool bRelease = true ) 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 // FIXME: this is a hack to workaround missing layout functionality
SAL_DLLPRIVATE void ImplAdjustNWFSizes(); SAL_DLLPRIVATE void ImplAdjustNWFSizes();
......
...@@ -58,83 +58,51 @@ void OutputDevice::ImplInitClipRegion() ...@@ -58,83 +58,51 @@ void OutputDevice::ImplInitClipRegion()
{ {
DBG_TESTSOLARMUTEX(); DBG_TESTSOLARMUTEX();
if ( GetOutDevType() == OUTDEV_WINDOW ) if ( mbClipRegion )
{ {
Window* pWindow = (Window*)this; if ( maRegion.IsEmpty() )
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; mbOutputClipped = true;
else else
{ {
mbOutputClipped = false; mbOutputClipped = false;
ImplSelectClipRegion( aRegion );
} // #102532# Respect output offset also for clip region
mbClipRegionSet = true; Region aRegion( ImplPixelToDevicePixel( maRegion ) );
} const bool bClipDeviceBounds( ! GetPDFWriter()
else && GetOutDevType() != OUTDEV_PRINTER );
{ if( bClipDeviceBounds )
if ( mbClipRegion ) {
{ // Perform actual rect clip against outdev
if ( maRegion.IsEmpty() ) // 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; mbOutputClipped = true;
}
else else
{ {
mbOutputClipped = false; mbOutputClipped = false;
ImplSelectClipRegion( aRegion );
// #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; mbClipRegionSet = true;
}
else
{
if ( mbClipRegionSet )
{
mpGraphics->ResetClipRegion();
mbClipRegionSet = false;
} }
mbOutputClipped = false;
} }
mbInitClipRegion = false; mbInitClipRegion = false;
......
...@@ -406,6 +406,39 @@ bool Window::AcquireGraphics() const ...@@ -406,6 +406,39 @@ bool Window::AcquireGraphics() const
return mpGraphics ? true : false; 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 ) void Window::EnableRTL ( bool bEnable )
{ {
StateChanged( STATE_CHANGE_MIRRORING ); StateChanged( STATE_CHANGE_MIRRORING );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment