void BitonicSort( sort_direction aDir, typename std::vector<T>::iterator & aDataStart, typename std::vector<T>::iterator & aDataEnd ) { uint32_t lSize( aDataEnd - aDataStart ); if( lSize != 1 ){ typename std::vector<T>::iterator lMidpoint( aDataStart+(lSize>>1) ); BitonicSort<T> ( up, aDataStart , lMidpoint ); BitonicSort<T> ( down, lMidpoint , aDataEnd ); BitonicMerge<T> (aDir, aDataStart , aDataEnd ); }
void Layout::Recalc() { //!? if (valid) return; int i; for ( i = 0; i < lines.count(); i++ ) { lines[i].Clear(); } for ( i = 0; i < columns.count(); i++ ) { columns[i].Clear(); } wal::ccollect<LSize> lSize( objList.count() ); for ( i = 0; i < objList.count(); i++ ) { objList[i]->GetLSize( lSize.ptr() + i ); } for ( i = 0; i < objList.count(); i++ ) { LItem* p = objList[i].ptr(); LSize* ls = lSize.ptr() + i; if ( p->r1 == p->r2 ) { int r = p->r1; if ( lines[r].range.minimal < ls->y.minimal ) { lines[r].range.minimal = ls->y.minimal; } if ( lines[r].range.maximal < ls->y.maximal ) { lines[r].range.maximal = ls->y.maximal; } if ( lines[r].range.ideal < ls->y.ideal ) { lines[r].range.ideal = ls->y.ideal; } } if ( p->c1 == p->c2 ) { int c = p->c1; if ( columns[c].range.minimal < ls->x.minimal ) { columns[c].range.minimal = ls->x.minimal; } if ( columns[c].range.maximal < ls->x.maximal ) { columns[c].range.maximal = ls->x.maximal; } if ( columns[c].range.ideal < ls->x.ideal ) { columns[c].range.ideal = ls->x.ideal; } } } for ( i = 0; i < objList.count(); i++ ) { LItem* p = objList[i].ptr(); LSize* ls = lSize.ptr() + i; if ( p->r1 != p->r2 ) { SetMinRangeN( lines.ptr() + p->r1, p->r2 - p->r1 + 1, ls->y.minimal ); SetIdealRangeN( lines.ptr() + p->r1, p->r2 - p->r1 + 1, ls->y.ideal ); SetMaxRangeN( lines.ptr() + p->r1, p->r2 - p->r1 + 1, ls->y.maximal ); } if ( p->c1 != p->c2 ) { SetMinRangeN ( columns.ptr() + p->c1, p->c2 - p->c1 + 1, ls->x.minimal ); SetIdealRangeN( columns.ptr() + p->c1, p->c2 - p->c1 + 1, ls->x.ideal ); SetMaxRangeN ( columns.ptr() + p->c1, p->c2 - p->c1 + 1, ls->x.maximal ); /*чо за херня тут была SetMinRangeN(columns.ptr()+p->r1, p->r2-p->r1+1,ls->x.minimal); SetIdealRangeN(columns.ptr()+p->r1, p->r2-p->r1+1,ls->x.ideal); SetMaxRangeN(columns.ptr()+p->r1, p->r2-p->r1+1,ls->x.maximal); */ } } for ( i = 0; i < lines.count(); i++ ) { lines[i].range.Check(); } for ( i = 0; i < columns.count(); i++ ) { columns[i].range.Check(); } SetOptimalRange( lines.ptr(), lines.count(), currentRect.Height() ); SetOptimalRange( columns.ptr(), columns.count(), currentRect.Width() ); valid = true; }