diff options
author | Sebastian Geerken <devnull@localhost> | 2016-06-20 21:44:36 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2016-06-20 21:44:36 +0200 |
commit | 94c2d21c5c035fa056481ea6e6743f83ea651e78 (patch) | |
tree | bf04218bbe467fb81d265093e1469365f084d5ec /dw/ooffloatsmgr.cc | |
parent | 1d4da1af1d51e2b2de907c46666e05ef866a9300 (diff) |
Incremental resizing for OOFFloatsMgr.
Diffstat (limited to 'dw/ooffloatsmgr.cc')
-rw-r--r-- | dw/ooffloatsmgr.cc | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc index 84b2f6ff..0d701b0b 100644 --- a/dw/ooffloatsmgr.cc +++ b/dw/ooffloatsmgr.cc @@ -340,6 +340,9 @@ OOFFloatsMgr::OOFFloatsMgr (OOFAwareWidget *container, int oofmIndex) leftFloatsMark = rightFloatsMark = 0; lastLeftTBIndex = lastRightTBIndex = 0; + floatRef = -1; + DBG_OBJ_SET_NUM ("floatRef", floatRef); + containerAllocation = *(container->getAllocation()); addWidgetInFlow (this->container, NULL, 0); @@ -633,32 +636,40 @@ void OOFFloatsMgr::markSizeChange (int ref) { DBG_OBJ_ENTER ("resize.oofm", 0, "markSizeChange", "%d", ref); - Float *vloat; + // 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 - } + if (isSubRefLeftFloat (ref)) + vloat = leftFloats->get (getFloatIndexFromSubRef (ref)); + else if (isSubRefRightFloat (ref)) + vloat = rightFloats->get (getFloatIndexFromSubRef (ref)); + else { + assertNotReached(); + vloat = NULL; // compiler happiness + } - vloat->dirty = true; - DBG_OBJ_SET_BOOL_O (vloat->getWidget (), "<Float>.dirty", vloat->dirty); + vloat->dirty = true; + DBG_OBJ_SET_BOOL_O (vloat->getWidget (), "<Float>.dirty", vloat->dirty); - assert (vloat->getWidget()->getWidgetReference() != NULL); + 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); + 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); + floatRef = ref; + DBG_OBJ_SET_NUM ("floatRef", floatRef); + } + DBG_OBJ_LEAVE (); } @@ -925,6 +936,9 @@ void OOFFloatsMgr::getSize (Requisition *cbReq, int *oofWidth, int *oofHeight) *oofHeight = max (oofHeightLeft, oofHeightRight) + container->boxRestHeight (); + floatRef = -1; + DBG_OBJ_SET_NUM ("floatRef", floatRef); + DBG_OBJ_MSGF ("resize.oofm", 1, "=> (l: %d, r: %d => %d) * (l: %d, r: %d => %d)", oofWidthtLeft, oofWidthRight, *oofWidth, oofHeightLeft, |