-
- outline.opened = false;
-}
-
-
-static void _initBBox(SwBBox& bbox)
-{
- bbox.min.x = bbox.min.y = 0;
- bbox.max.x = bbox.max.y = 0;
-}
-
-
-static bool _updateBBox(SwOutline* outline, SwBBox& bbox)
-{
- if (!outline) return false;
-
- auto pt = outline->pts;
-
- if (outline->ptsCnt <= 0) {
- _initBBox(bbox);
- return false;
- }
-
- auto xMin = pt->x;
- auto xMax = pt->x;
- auto yMin = pt->y;
- auto yMax = pt->y;
-
- ++pt;
-
- for(uint32_t i = 1; i < outline->ptsCnt; ++i, ++pt) {
- if (xMin > pt->x) xMin = pt->x;
- if (xMax < pt->x) xMax = pt->x;
- if (yMin > pt->y) yMin = pt->y;
- if (yMax < pt->y) yMax = pt->y;
- }
- bbox.min.x = xMin >> 6;
- bbox.max.x = (xMax + 63) >> 6;
- bbox.min.y = yMin >> 6;
- bbox.max.y = (yMax + 63) >> 6;
-
- if (xMax - xMin < 1 && yMax - yMin < 1) return false;
-
- return true;
-}
-
-
-static bool _checkValid(const SwOutline* outline, const SwBBox& bbox, const SwSize& clip)
-{
- if (outline->ptsCnt == 0 || outline->cntrsCnt <= 0) return false;
-
- //Check boundary
- if (bbox.min.x >= clip.w || bbox.min.y >= clip.h || bbox.max.x <= 0 || bbox.max.y <= 0) return false;
-
- return true;