static bool is_above(WStacking *st, WStacking *p) { if(st->above==NULL) return FALSE; else if(st->above==p) return TRUE; else return is_above(st->above, p); }
static void collect_above(WStacking **dst, WStacking **src, WStacking *regst) { WStacking *stabove, *stnext; for(stabove=*src; stabove!=NULL; stabove=stnext){ stnext=stabove->next; if(is_above(stabove, regst)) collect_last(dst, src, stabove); } }
bool vframeOopClass::is_above(abstract_vframe* vf){ if (is_above(vf->fr)) return true; if (is_below(vf->fr)) return false; return descOffset() < vf->descOffset(); }
void MyView::CopyRegion(BRegion *region, int32 xOffset, int32 yOffset) { wind->Lock(); int32 count = region->CountRects(); // TODO: make this step unnecessary // (by using different stack impl inside node) node nodes[count]; for (int32 i= 0; i < count; i++) { nodes[i].init(region->RectAt(i), count); } for (int32 i = 0; i < count; i++) { BRect a = region->RectAt(i); for (int32 k = i + 1; k < count; k++) { BRect b = region->RectAt(k); int cmp = 0; // compare horizontally if (xOffset > 0) { if (is_left_of(a, b)) { cmp -= 1; } else if (is_left_of(b, a)) { cmp += 1; } } else if (xOffset < 0) { if (is_left_of(a, b)) { cmp += 1; } else if (is_left_of(b, a)) { cmp -= 1; } } // compare vertically if (yOffset > 0) { if (is_above(a, b)) { cmp -= 1; } else if (is_above(b, a)) { cmp += 1; } } else if (yOffset < 0) { if (is_above(a, b)) { cmp += 1; } else if (is_above(b, a)) { cmp -= 1; } } // add appropriate node as successor if (cmp > 0) { nodes[i].push(&nodes[k]); nodes[k].in_degree++; } else if (cmp < 0) { nodes[k].push(&nodes[i]); nodes[i].in_degree++; } } } // put all nodes onto a stack that have an "indegree" count of zero stack<node*> inDegreeZeroNodes; for (int32 i = 0; i < count; i++) { if (nodes[i].in_degree == 0) { inDegreeZeroNodes.push(&nodes[i]); } } // pop the rects from the stack, do the actual copy operation // and decrease the "indegree" count of the other rects not // currently on the stack and to which the current rect pointed // to. If their "indegree" count reaches zero, put them onto the // stack as well. while (!inDegreeZeroNodes.empty()) { node* n = inDegreeZeroNodes.top(); inDegreeZeroNodes.pop(); CopyBits(n->rect, BRect(n->rect).OffsetByCopy(xOffset, yOffset)); for (int32 k = 0; k < n->next_pointer; k++) { n->pointers[k]->in_degree--; if (n->pointers[k]->in_degree == 0) inDegreeZeroNodes.push(n->pointers[k]); } } wind->Unlock(); }
constexpr bool contains(const size_t bit_count) const { return !is_above(bit_count) && !is_below(bit_count); }