Ceil and floor min and max size respectively gives better results.

This commit is contained in:
czeidler 2012-09-01 15:45:59 +12:00
parent 25e1abc33c
commit de679878b7

View File

@ -38,8 +38,8 @@ struct SharedSolver::MinSizeValidator {
if (solveResult == LinearProgramming::kUnbounded) { if (solveResult == LinearProgramming::kUnbounded) {
solver->SetMinSize(layout, BSize(0, 0)); solver->SetMinSize(layout, BSize(0, 0));
} else { } else {
solver->SetMinSize(layout, BSize(layout->Right()->Value(), solver->SetMinSize(layout, BSize(ceilf(layout->Right()->Value()),
layout->Bottom()->Value())); ceilf(layout->Bottom()->Value())));
} }
} }
}; };
@ -58,8 +58,8 @@ struct SharedSolver::MaxSizeValidator {
solver->SetMaxSize(layout, solver->SetMaxSize(layout,
BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
} else { } else {
solver->SetMaxSize(layout, BSize(layout->Right()->Value(), solver->SetMaxSize(layout, BSize(floorf(layout->Right()->Value()),
layout->Bottom()->Value())); floorf(layout->Bottom()->Value())));
} }
} }
}; };