36 if (iBoundingRect && std::get<0>(*iBoundingRect) == aOffsetPosition && std::get<1>(*iBoundingRect) == aPixelWidthAdjustment)
37 return std::get<2>(*iBoundingRect);
38 coordinate_type minX = std::numeric_limits<coordinate_type>::infinity();
39 coordinate_type minY = std::numeric_limits<coordinate_type>::infinity();
40 coordinate_type maxX = -std::numeric_limits<coordinate_type>::infinity();
41 coordinate_type maxY = -std::numeric_limits<coordinate_type>::infinity();
42 for (
auto const& sub_path : iSubPaths)
43 for (
auto const&
point : sub_path)
45 minX = std::min(minX,
point.
x);
46 minY = std::min(minY,
point.
y);
47 maxX = std::max(maxX,
point.
x);
48 maxY = std::max(maxY,
point.
y);
50 iBoundingRect = std::make_tuple(
52 aPixelWidthAdjustment,
54 return std::get<2>(*iBoundingRect);
64 else if (aRect.
x == aClipRects.back().x && aRect.
cx == aClipRects.back().cx && aRect.
y == aClipRects.back().bottom())
84 mesh_type boundingRect = bounding_rect() + aOrigin;
85 typedef std::vector<line_type> lines_t;
86 typename lines_t::size_type lineCount = 0;
87 for (
auto const& sub_path : iSubPaths)
88 lineCount += !sub_path.empty() ? sub_path.size() - 1 : 0;
90 lines.reserve(lineCount);
91 for (
auto const& sub_path : iSubPaths)
93 if (sub_path.size() > 1)
96 for (
auto pt = sub_path.begin() + 1;
pt != sub_path.end(); ++
pt)
98 auto const ptAdjusted = *
pt + aOrigin;
99 lines.push_back(
line_type(ptPrevious, ptAdjusted));
100 ptPrevious = ptAdjusted;
105 clipRects.reserve(16);
106 intersect_list xIntersects;
111 for (
auto const& line1 : lines)
114 if (line1.intersection(scanLine,
pt))
116 if (!line1.is_vertex(
pt))
117 xIntersects.push_back(intersect(
pt.x));
119 for (
auto const& line2 : lines)
121 if (line2.is_vertex(
pt) && &line2 != &line1)
125 if ((cornerLine1.delta_y() > 0 && cornerLine2.delta_y() < 0) || (cornerLine1.delta_y() < 0 && cornerLine2.delta_y() > 0))
126 xIntersects.push_back(intersect(
pt.x));
128 xIntersects.push_back(intersect(
pt.x, cornerLine2.delta_y() != 0));
133 std::sort(xIntersects.begin(), xIntersects.end());
134 auto end = std::unique(xIntersects.begin(), xIntersects.end());
135 bool hadFirst =
false;
137 intersect previousIntersect;
138 for (
auto const& currentIntersect : xIntersects)
142 bool isHorizontalEdge =
false;
143 for (
auto line1 = lines.begin(); !isHorizontalEdge && line1 != lines.end(); ++line1)
147 isHorizontalEdge =
true;
149 for (
auto line2 = lines.begin(); !found && line2 != lines.end(); ++line2)
150 if (line2->is_vertex(line1.a) && line2 != line1)
151 for (
auto line3 = lines.begin(); !found && line3 != lines.end(); ++line3)
152 if (line3->is_vertex(line1->b) && line3 != line1)
155 if ((line2->delta_y() > 0 && line3->delta_y() < 0) || (line2->delta_y() < 0 && line3->delta_y() > 0))
160 if (!isHorizontalEdge && currentIntersect.x() - previousIntersect.x() >= 2)
164 add_clip_rect<point_type>(clipRects,
167 if (!currentIntersect.skip())
170 else if (!isHorizontalEdge && !currentIntersect.skip() && !previousIntersect.skip())
174 previousIntersect = currentIntersect;