aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-01-30 17:17:07 +0100
committerSebastian Geerken <devnull@localhost>2014-01-30 17:17:07 +0100
commit91a174cec662affc189ea4ad71e7819a768a2a37 (patch)
treec75f1423e5ae93b800c809012e4cb77daeb1a1d3
parentebef4a549506bf6d6dced5ae0edddc41d0185ebc (diff)
Recent optimizations hopefully finished.
-rw-r--r--dw/outofflowmgr.cc54
-rw-r--r--dw/outofflowmgr.hh1
2 files changed, 35 insertions, 20 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc
index 436fbfd7..345e5a0e 100644
--- a/dw/outofflowmgr.cc
+++ b/dw/outofflowmgr.cc
@@ -44,13 +44,21 @@ int OutOfFlowMgr::WidgetInfo::compareTo(Comparable *other)
return 0;
}
+
+void OutOfFlowMgr::WidgetInfo::update (bool wasAllocated, int xCB, int yCB,
+ int width, int height)
+{
+ this->wasAllocated = wasAllocated;
+ this->xCB = xCB;
+ this->yCB = yCB;
+ this->width = width;
+ this->height = height;
+}
+
void OutOfFlowMgr::WidgetInfo::updateAllocation ()
{
- wasAllocated = isNowAllocated ();
- xCB = getNewXCB ();
- yCB = getNewYCB ();
- width = getNewWidth ();
- height = getNewHeight ();
+ update (isNowAllocated (), getNewXCB (), getNewYCB (), getNewWidth (),
+ getNewHeight ());
}
// ----------------------------------------------------------------------
@@ -1225,41 +1233,47 @@ void OutOfFlowMgr::checkRelationPosChanged (Float *vloat, Side side, int oldY)
// Only this float has been changed (see tellFloatPosition), so
// only this float has to be tested against all textblocks.
- if (wasAllocated (vloat->generatingBlock)) {
+ if (vloat->isNowAllocated ()) {
// TODO This (and similar code) is not very efficient.
+ Allocation *gba = getAllocation (vloat->generatingBlock);
+ TBInfo *gbInfo = getTextblock (vloat->generatingBlock);
+ int newFlx = calcFloatX (vloat, side,
+ gba->x - containingBlockAllocation.x,
+ gba->width, gbInfo->availWidth),
+ newFly = vloat->yReal + gba->x - containingBlockAllocation.y;
+
for (lout::container::typed::Iterator<TypedPointer <Textblock> > it =
tbInfosByTextblock->iterator (); it.hasNext (); ) {
TypedPointer <Textblock> *key = it.getNext ();
Textblock *textblock = key->getTypedValue();
+ // ensureFloatSize is not called; we take the old size
+ // here. Potential changes are handled later. Notice that
+ // calcFloatX does not call ensureFloatSize.
if (textblock != vloat->generatingBlock && wasAllocated (textblock)) {
Allocation *tba = getAllocation (textblock);
- Allocation *gba = getAllocation (vloat->generatingBlock);
- TBInfo *gbInfo = getTextblock (vloat->generatingBlock);
int tbx = tba->x - containingBlockAllocation.x,
tby = tba->y - containingBlockAllocation.y, tbw = tba->width,
tbh = tba->ascent + tba->descent;
- // ensureFloatSize is not called; we take the old size
- // here. Potential changes are handled later. Notice that
- // calcFloatX does not call ensureFloatSize.
- int flx = calcFloatX (vloat, side,
- gba->x - containingBlockAllocation.x,
- gba->width, gbInfo->availWidth),
- flyOld = oldY + gba->x - containingBlockAllocation.y,
- flyNew = vloat->yReal + gba->x - containingBlockAllocation.y,
- flw = vloat->size.width,
- flh = vloat->size.ascent + vloat->size.descent;
int pos;
if (hasRelationChanged (true, tbx, tby, tbw, tbh,
tbx, tby, tbw, tbh,
- true, flx, flyOld, flh, flw,
- flx, flyNew, flh, flw, side, &pos))
+ vloat->wasThenAllocated (),
+ vloat->getOldXCB (), vloat->getOldYCB (),
+ vloat->getOldWidth (),
+ vloat->getOldHeight (),
+ newFlx, newFly, vloat->size.width,
+ vloat->size.ascent + vloat->size.descent,
+ side, &pos))
textblock->borderChanged (pos + containingBlockAllocation.y
- tba->y,
vloat->getWidget ());
}
}
+
+ vloat->update (true, newFlx, newFly, vloat->size.width,
+ vloat->size.ascent + vloat->size.descent);
}
DBG_OBJ_MSG_END ();
diff --git a/dw/outofflowmgr.hh b/dw/outofflowmgr.hh
index a4a1e361..ce2743ac 100644
--- a/dw/outofflowmgr.hh
+++ b/dw/outofflowmgr.hh
@@ -61,6 +61,7 @@ private:
inline int getNewHeight () { return widget->getAllocation()->ascent +
widget->getAllocation()->descent; }
+ void update (bool wasAllocated, int xCB, int yCB, int width, int height);
void updateAllocation ();
inline core::Widget *getWidget () { return widget; }