Skip to content

Commit

Permalink
jx: horiz/vert partition: fix logic for FTC
Browse files Browse the repository at this point in the history
  • Loading branch information
jafl committed Feb 8, 2024
1 parent e2debcd commit 4a54304
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions libjx/code/JXHorizPartition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ JXHorizPartition::RunInternalFTC
}

itsFTCSizes->AppendItem(w);
itsFTCMinSizes->AppendItem(JPartition::GetMinCompartmentSize(i) + delta);
const JCoordinate min = JPartition::GetMinCompartmentSize(i) + delta;
itsFTCMinSizes->AppendItem(delta >= 0 ? min : JMax(w, min));
sum += w;
i++;
}
Expand Down Expand Up @@ -433,14 +434,14 @@ JXHorizPartition::FTCAdjustSize

if (itsFTCSizes != nullptr)
{
SetCompartmentSizes(*itsFTCSizes);
jdelete itsFTCSizes;
itsFTCSizes = nullptr;

SetMinCompartmentSizes(*itsFTCMinSizes);
jdelete itsFTCMinSizes;
itsFTCMinSizes = nullptr;

SetCompartmentSizes(*itsFTCSizes);
jdelete itsFTCSizes;
itsFTCSizes = nullptr;

if (itsSavedGeom != nullptr)
{
RestoreGeometry(*itsSavedGeom);
Expand Down
11 changes: 6 additions & 5 deletions libjx/code/JXVertPartition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ JXVertPartition::RunInternalFTC
}

itsFTCSizes->AppendItem(h);
itsFTCMinSizes->AppendItem(JPartition::GetMinCompartmentSize(i) + delta);
const JCoordinate min = JPartition::GetMinCompartmentSize(i) + delta;
itsFTCMinSizes->AppendItem(delta >= 0 ? min : JMax(h, min));
sum += h;
i++;
}
Expand All @@ -433,14 +434,14 @@ JXVertPartition::FTCAdjustSize

if (itsFTCSizes != nullptr)
{
SetCompartmentSizes(*itsFTCSizes);
jdelete itsFTCSizes;
itsFTCSizes = nullptr;

SetMinCompartmentSizes(*itsFTCMinSizes);
jdelete itsFTCMinSizes;
itsFTCMinSizes = nullptr;

SetCompartmentSizes(*itsFTCSizes);
jdelete itsFTCSizes;
itsFTCSizes = nullptr;

if (itsSavedGeom != nullptr)
{
RestoreGeometry(*itsSavedGeom);
Expand Down

0 comments on commit 4a54304

Please sign in to comment.