summaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2016-07-17 12:04:52 +0200
committerSebastian Geerken <devnull@localhost>2016-07-17 12:04:52 +0200
commit4e4ab35ea8a0fef370277739e79588e28ba25f74 (patch)
treea31b958287528452e9f624ce27399f715add8f3c /dw
parenta77b6ffde98421343157f60dfc12beb7ec4d25f3 (diff)
Reverse commit 4647:8c6b1b79d329.
Diffstat (limited to 'dw')
-rw-r--r--dw/ooffloatsmgr.cc68
-rw-r--r--dw/ooffloatsmgr.hh2
2 files changed, 31 insertions, 39 deletions
diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc
index 4f16ae42..5e6570fa 100644
--- a/dw/ooffloatsmgr.cc
+++ b/dw/ooffloatsmgr.cc
@@ -338,8 +338,8 @@ OOFFloatsMgr::OOFFloatsMgr (OOFAwareWidget *container, int oofmIndex)
leftFloatsMark = rightFloatsMark = 0;
lastLeftTBIndex = lastRightTBIndex = 0;
- SizeChanged = true;
- DBG_OBJ_SET_BOOL ("SizeChanged", SizeChanged);
+ floatRef = -1;
+ DBG_OBJ_SET_NUM ("floatRef", floatRef);
containerAllocation = *(container->getAllocation());
@@ -630,51 +630,43 @@ OOFFloatsMgr::Float *OOFFloatsMgr::findFloatByWidget (Widget *widget)
return vloat;
}
-/*
- * Currently this is a compound recursion for textblocks:
- * markSizeChange -> updateReference -> queueResize -> markSizeChange
- * One way to see it is as a widget tree coverage problem. i.e. to cover all
- * the nodes that need a resize when a float changes its size.
- * The coverage logic of it is shared between resize code and mark code (here).
- *
- * This implementation works for all the test cases so far. It relies on the
- * fact that Widget::queueResize should be called whenever a widget changes its
- * size. When "SizeChanged" is true, we notify the parent, when not, just the
- * following textblocks.
- */
void OOFFloatsMgr::markSizeChange (int ref)
{
DBG_OBJ_ENTER ("resize.oofm", 0, "markSizeChange", "%d", ref);
- // When "SizeChanged" is true, we know this float changed its size.
- // This helps to prune redundant passes.
- // "SizeChanged" is set by getSize(), which is called by sizeRequest().
-
- SortedFloatsVector *list;
- list = isSubRefLeftFloat(ref) ? leftFloats : rightFloats;
- Float *vloat = list->get (getFloatIndexFromSubRef (ref));
-
- vloat->dirty = true;
- DBG_OBJ_SET_BOOL_O (vloat->getWidget (), "<Float>.dirty", vloat->dirty);
-
- assert (vloat->getWidget()->getWidgetReference() != NULL);
-
- int first = getOOFAwareWidget(vloat->generator)->index;
- DBG_OBJ_MSGF ("resize.oofm", 1, "updating from %d", first);
+ // We implement "incremental resizing" (kind of), by remembering the largest
+ // value for "ref", in "floatRef". It is reset again in getSize(), which is
+ // called by sizeRequest().
+ if (floatRef == -1 || ref > floatRef) {
+ Float *vloat;
+
+ if (isSubRefLeftFloat (ref))
+ vloat = leftFloats->get (getFloatIndexFromSubRef (ref));
+ else if (isSubRefRightFloat (ref))
+ vloat = rightFloats->get (getFloatIndexFromSubRef (ref));
+ else {
+ assertNotReached();
+ vloat = NULL; // compiler happiness
+ }
- //printf("IN markSizeChange %p ref %d SzCh=%d\n", this, ref,
- // (int)SizeChanged);
+ vloat->dirty = true;
+ DBG_OBJ_SET_BOOL_O (vloat->getWidget (), "<Float>.dirty", vloat->dirty);
- if (SizeChanged)
+ assert (vloat->getWidget()->getWidgetReference() != NULL);
+
+ int first = getOOFAwareWidget(vloat->generator)->index;
+ DBG_OBJ_MSGF ("resize.oofm", 1, "updating from %d", first);
+
tbInfos->get(first)->getOOFAwareWidget()
->updateReference (vloat->getWidget()->getWidgetReference()
->parentRef);
+
+ for (int i = first + 1; i < tbInfos->size(); i++)
+ tbInfos->get(i)->getOOFAwareWidget()->updateReference(0);
- for (int i = first + 1; i < tbInfos->size(); i++)
- tbInfos->get(i)->getOOFAwareWidget()->updateReference(0);
-
- SizeChanged = false; // Done.
- DBG_OBJ_SET_BOOL ("SizeChanged", SizeChanged);
+ floatRef = ref;
+ DBG_OBJ_SET_NUM ("floatRef", floatRef);
+ }
DBG_OBJ_LEAVE ();
}
@@ -929,7 +921,7 @@ void OOFFloatsMgr::getSize (Requisition *cbReq, int *oofWidth, int *oofHeight)
*oofHeight =
max (oofHeightLeft, oofHeightRight) + container->boxRestHeight ();
- SizeChanged = true;
+ floatRef = -1;
DBG_OBJ_SET_NUM ("floatRef", floatRef);
DBG_OBJ_MSGF ("resize.oofm", 1,
diff --git a/dw/ooffloatsmgr.hh b/dw/ooffloatsmgr.hh
index d514d28b..fdc59fb4 100644
--- a/dw/ooffloatsmgr.hh
+++ b/dw/ooffloatsmgr.hh
@@ -165,7 +165,7 @@ private:
TBInfo> *tbInfosByOOFAwareWidget;
int lastLeftTBIndex, lastRightTBIndex, leftFloatsMark, rightFloatsMark;
- bool SizeChanged;
+ int floatRef;
void moveExternalIndices (lout::container::typed::Vector<Float> *list,
int oldStartIndex, int diff);