Improve efficiency when validating an ALM layout.
This commit is contained in:
@@ -1016,12 +1016,6 @@ BALMLayout::UpdateConstraints(BLayoutContext* context)
|
|||||||
for (int i = 0; i < CountItems(); i++)
|
for (int i = 0; i < CountItems(); i++)
|
||||||
AreaFor(ItemAt(i))->InvalidateSizeConstraints();
|
AreaFor(ItemAt(i))->InvalidateSizeConstraints();
|
||||||
fRowColumnManager->UpdateConstraints();
|
fRowColumnManager->UpdateConstraints();
|
||||||
|
|
||||||
if (context) {
|
|
||||||
BSize size(LayoutArea().Size());
|
|
||||||
Right()->SetRange(size.width, size.width);
|
|
||||||
Bottom()->SetRange(size.height, size.height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -194,11 +194,17 @@ SharedSolver::ValidateLayout(BLayoutContext* context)
|
|||||||
if (fLayoutValid && fLayoutContext == context)
|
if (fLayoutValid && fLayoutContext == context)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fConstraintsValid = false;
|
|
||||||
_SetContext(context);
|
_SetContext(context);
|
||||||
_ValidateConstraints();
|
_ValidateConstraints();
|
||||||
fLayoutResult = fLinearSpec.Solve();
|
|
||||||
|
|
||||||
|
for (int32 i = fLayouts.CountItems() - 1; i >= 0; i--) {
|
||||||
|
BALMLayout* layout = fLayouts.ItemAt(i);
|
||||||
|
BSize size(layout->LayoutArea().Size());
|
||||||
|
layout->Right()->SetRange(size.width, size.width);
|
||||||
|
layout->Bottom()->SetRange(size.height, size.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
fLayoutResult = fLinearSpec.Solve();
|
||||||
fLayoutValid = true;
|
fLayoutValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user