summaryrefslogtreecommitdiff
path: root/svx/source/dialog/dialcontrol.cxx
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2013-06-11 15:56:24 +0200
committerJan Holesovsky <kendy@suse.cz>2013-06-11 16:06:20 +0200
commit3d0a22e8c3a848f7413d6bd090106371227260d0 (patch)
treed909af085d1832e5bd15ca9990de68eef33806d0 /svx/source/dialog/dialcontrol.cxx
parente78fe7af3961098b72116faf6b95eebb3685670b (diff)
dialcontrol: Make it always fit a square.
Change-Id: I37e1d694a5e92b75bd68310f74671897887a60e1
Diffstat (limited to 'svx/source/dialog/dialcontrol.cxx')
-rw-r--r--svx/source/dialog/dialcontrol.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx
index 5ebb3964d4fa..3c9ce6829e4a 100644
--- a/svx/source/dialog/dialcontrol.cxx
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -248,8 +248,11 @@ void DialControl::DialControl_Impl::Init( const Size& rWinSize, const Font& rWin
void DialControl::DialControl_Impl::SetSize( const Size& rWinSize )
{
- // "(x - 1) | 1" creates odd value <= x, to have a well-defined center pixel position
- maWinSize = Size( (rWinSize.Width() - 1) | 1, (rWinSize.Height() - 1) | 1 );
+ // make the control squared, and adjusted so that we have a well-defined
+ // center ["(x - 1) | 1" creates odd value <= x]
+ long nMin = (std::min(rWinSize.Width(), rWinSize.Height()) - 1) | 1;
+
+ maWinSize = Size( nMin, nMin );
mnCenterX = maWinSize.Width() / 2;
mnCenterY = maWinSize.Height() / 2;