Follows the suggestion by Stefano and caches the square root.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16904 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5deac87dd2
commit
74e8df0e6e
@ -40,10 +40,12 @@ void
|
|||||||
WorkspacesLayer::_GetGrid(int32& columns, int32& rows)
|
WorkspacesLayer::_GetGrid(int32& columns, int32& rows)
|
||||||
{
|
{
|
||||||
DesktopSettings settings(Window()->Desktop());
|
DesktopSettings settings(Window()->Desktop());
|
||||||
|
|
||||||
int32 count = settings.WorkspacesCount();
|
int32 count = settings.WorkspacesCount();
|
||||||
|
int32 squareRoot = sqrt(count);
|
||||||
|
|
||||||
rows = 1;
|
rows = 1;
|
||||||
for (int32 i = 2; i <= sqrt(count); i++) {
|
for (int32 i = 2; i <= squareRoot; i++) {
|
||||||
if (count % i == 0)
|
if (count % i == 0)
|
||||||
rows = i;
|
rows = i;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user