Thatis acutally wrong that might access invalid data.
The below line, memory indexing
box_type_t *box = PIXREGION_RECTS(reg) + index;
won't work properly since the reg memory is not the exact box_type_t.
Change-Id: I872235580de839a1cc19aad8c5e7564ae56cc68e
return PREFIX(_n_rects)(d->rgn);
}
-VRect VRegion::rectAt(int index) const
-{
- VRegionPrivate *reg = d->rgn;
- if (!reg) return {};
-
- box_type_t *box = PIXREGION_RECTS(reg) + index;
-
- return box_to_rect(box);
-}
-
VRegion VRegion::operator+(const VRect &r) const
{
return united(r);
return PREFIX(_intersects)(d->rgn, r.d->rgn);
}
-
-VDebug &operator<<(VDebug &os, const VRegion &o)
-{
- os << "[REGION: "
- << "[bbox = " << o.boundingRect() << "]";
- os << "[rectCount = " << o.rectCount() << "]";
- os << "[rects = ";
- for (int i = 0; i < o.rectCount(); i++) {
- os << o.rectAt(i);
- }
- os << "]"
- << "]";
- return os;
-}
-
V_END_NAMESPACE