--- a/src/polygoncache.cpp Sat Apr 08 22:09:29 2023 +0300 +++ b/src/polygoncache.cpp Sun Apr 09 00:56:49 2023 +0300 @@ -70,7 +70,7 @@ if (polygon.color == MAIN_COLOR) { polygon.color = ref.color; } - add(polygon); + add(1, polygon); } } @@ -106,16 +106,16 @@ } }, [&](const LineType2& line2) { - add({line2.value, line2.value.color}); + add(2, {line2.value, line2.value.color}); }, [&](const LineType3& line3) { - add({line3.value, line3.value.color}); + add(3, {line3.value, line3.value.color}); }, [&](const LineType4& line4) { - add({line4.value, line4.value.color}); + add(4, {line4.value, line4.value.color}); }, [&](const LineType5& line5) { - add({line5.value, line5.value.color}); + add(5, {line5.value, line5.value.color}); }, [&add, context, &reserve](const LineType1& line1) { QTextDocument* const dependency = findDependency(line1.value, context); @@ -150,9 +150,9 @@ Winding winding = NoWinding; std::vector<WithId<PolygonElement>> result; int i = 0; - const auto add = [&result, winding, i](const PolygonElement& poly){ + const auto add = [&result, &winding, &i](int lineno, const PolygonElement& poly){ result.push_back({poly, i}); - if (winding == Winding::Clockwise) { + if (lineno != 1 and winding == Winding::Clockwise) { gl::invert(result.back()); } };