Kaydet (Commit) 3d0a22e8 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

dialcontrol: Make it always fit a square.

Change-Id: I37e1d694a5e92b75bd68310f74671897887a60e1
üst e78fe7af
...@@ -248,8 +248,11 @@ void DialControl::DialControl_Impl::Init( const Size& rWinSize, const Font& rWin ...@@ -248,8 +248,11 @@ void DialControl::DialControl_Impl::Init( const Size& rWinSize, const Font& rWin
void DialControl::DialControl_Impl::SetSize( const Size& rWinSize ) void DialControl::DialControl_Impl::SetSize( const Size& rWinSize )
{ {
// "(x - 1) | 1" creates odd value <= x, to have a well-defined center pixel position // make the control squared, and adjusted so that we have a well-defined
maWinSize = Size( (rWinSize.Width() - 1) | 1, (rWinSize.Height() - 1) | 1 ); // 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; mnCenterX = maWinSize.Width() / 2;
mnCenterY = maWinSize.Height() / 2; mnCenterY = maWinSize.Height() / 2;
......
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