summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2014-06-05 01:17:48 +1000
committerChris Sherlock <chris.sherlock79@gmail.com>2014-07-19 23:40:54 +1000
commitf3894bd0bd8ee9472f1ae595b9f6616ed4e4717f (patch)
tree5a24943cf4b86bbfbf1a4e895642f07cb08bbd45
parentcc41d52af226f6c4fdfd8e300b81d0f61d633053 (diff)
vcl: GetWindowClipRegionPixel simplified
Window::GetWindowClipRegionPixel() has a lot of unneeded functionality. It's not being (ab)used anywhere except for SwViewShell::SmoothScroll() which uses it to work out if clipping area covers the whole window or not (taking into account the child clipping area). So I've basically removed the unneeded flags, and now it doesn't return a region, I just use it as a check to see if the clipping area covers the whole window - hence the name change to ClipCoversWholeWindow(), which now just returns a boolean value. Change-Id: I182cb91d78f4a44ff5da86d768d9ece0633ae3a3
-rw-r--r--include/vcl/window.hxx6
-rw-r--r--sw/source/core/view/viewsh.cxx2
-rw-r--r--vcl/source/window/clipping.cxx38
3 files changed, 11 insertions, 35 deletions
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 753ecd3bbbe9..cf85e30bc94c 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -281,10 +281,6 @@ typedef sal_uInt16 StateChangedType;
#define WINDOW_DLGCTRL_MOD1TAB ((sal_uInt16)0x0004)
#define WINDOW_DLGCTRL_FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0008)
-// GetWindowClipRegionPixel-Flags
-#define WINDOW_GETCLIPREGION_NULL ((sal_uInt16)0x0001)
-#define WINDOW_GETCLIPREGION_NOCHILDREN ((sal_uInt16)0x0002)
-
// EndExtTextInput-Flags
#define EXTTEXTINPUT_END_COMPLETE ((sal_uInt16)0x0001)
#define EXTTEXTINPUT_END_CANCEL ((sal_uInt16)0x0002)
@@ -775,7 +771,7 @@ public:
void SetWindowRegionPixel( const Region& rRegion );
const Region& GetWindowRegionPixel() const;
bool IsWindowRegionPixel() const;
- Region GetWindowClipRegionPixel( sal_uInt16 nFlags = 0 ) const;
+ bool ClipCoversWholeWindow();
Region GetPaintRegion() const;
bool IsInPaint() const;
// while IsInPaint returns true ExpandPaintClipRegion adds the
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 6571a5f09af7..f7cd51816b52 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1178,7 +1178,7 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect
// #i75172# isolated static conditions
const bool bOnlyYScroll(!lXDiff && std::abs(lYDiff) != 0 && std::abs(lYDiff) < lMax);
- const bool bAllowedWithChildWindows(GetWin()->GetWindowClipRegionPixel(WINDOW_GETCLIPREGION_NOCHILDREN|WINDOW_GETCLIPREGION_NULL).IsNull());
+ const bool bAllowedWithChildWindows(GetWin()->ClipCoversWholeWindow());
const bool bSmoothScrollAllowed(bOnlyYScroll && mbEnableSmooth && GetViewOptions()->IsSmoothScroll() && bAllowedWithChildWindows);
if(bSmoothScrollAllowed)
diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx
index c0de87c40732..56c64326b0fa 100644
--- a/vcl/source/window/clipping.cxx
+++ b/vcl/source/window/clipping.cxx
@@ -102,42 +102,22 @@ void Window::ExpandPaintClipRegion( const Region& rRegion )
}
}
-Region Window::GetWindowClipRegionPixel( sal_uInt16 nFlags ) const
+bool Window::ClipCoversWholeWindow()
{
ClipManager *clipMgr = ClipManager::GetInstance();
- Region aWinClipRegion;
+ bool bCoversWholeWindow = false;
- if ( nFlags & WINDOW_GETCLIPREGION_NOCHILDREN )
- {
- if ( mpWindowImpl->mbInitWinClipRegion )
- clipMgr->InitClipRegion(const_cast<Window *>(this));
- aWinClipRegion = mpWindowImpl->maWinClipRegion;
- }
- else
- {
- Region* pWinChildClipRegion = clipMgr->GetChildClipRegion(const_cast<Window*>(this));
- aWinClipRegion = *pWinChildClipRegion;
- // --- RTL --- remirror clip region before passing it to somebody
- if( ImplIsAntiparallel() )
- {
- const OutputDevice *pOutDev = GetOutDev();
- pOutDev->ReMirror( aWinClipRegion );
- }
- }
+ if ( mpWindowImpl->mbInitWinClipRegion )
+ clipMgr->InitClipRegion( this );
- if ( nFlags & WINDOW_GETCLIPREGION_NULL )
- {
- Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
- Region aWinRegion( aWinRect );
-
- if ( aWinRegion == aWinClipRegion )
- aWinClipRegion.SetNull();
- }
+ Region aWinClipRegion = mpWindowImpl->maWinClipRegion;
+ Region aWinRegion( Rectangle ( Point( mnOutOffX, mnOutOffY ), GetOutputSizePixel() ) );
- aWinClipRegion.Move( -mnOutOffX, -mnOutOffY );
+ if ( aWinRegion == aWinClipRegion )
+ bCoversWholeWindow = true;
- return aWinClipRegion;
+ return bCoversWholeWindow;
}