Skip to content

Commit

Permalink
Fixed|UI|Client|GridLayout: Operations on NULL rules
Browse files Browse the repository at this point in the history
Todo: Something is causing a big perf hit...
  • Loading branch information
skyjake committed Aug 19, 2013
1 parent 24d9997 commit abbe8ed
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions doomsday/client/src/ui/widgets/gridlayout.cpp
Expand Up @@ -181,16 +181,22 @@ DENG2_PIMPL(GridLayout)
Rule const &columnBaseX(int col) const // refless
{
Rule const *base = holdRef(initialX);
if(col > 0 && colPad) changeRef(base, *base + *colPad * col);
sumInto(base, *cols.at(col)->accum);
if(col > 0)
{
if(colPad) changeRef(base, *base + *colPad * col);
sumInto(base, *cols.at(col)->accum);
}
return *refless(base);
}

Rule const &rowBaseY(int row) const // refless
{
Rule const *base = holdRef(initialY);
if(row > 0 && rowPad) changeRef(base, *base + *rowPad * row);
sumInto(base, *rows.at(row)->accum);
if(row > 0)
{
if(rowPad) changeRef(base, *base + *rowPad * row);
sumInto(base, *rows.at(row)->accum);
}
return *refless(base);
}

Expand Down Expand Up @@ -353,6 +359,9 @@ DENG2_PIMPL(GridLayout)
sumInto(totalHeight, *rows.at(i)->final);
}

if(!totalWidth) totalWidth = new ConstantRule(0);
if(!totalHeight) totalHeight = new ConstantRule(0);

needTotalUpdate = false;
}
};
Expand Down

0 comments on commit abbe8ed

Please sign in to comment.