From 6de079a487cdaff1c9e0a572fc3ae6498cb7c4e6 Mon Sep 17 00:00:00 2001 From: Prokhorov Kirill Date: Fri, 10 Oct 2025 00:47:56 +0300 Subject: [PATCH] Fix bug 76927 --- DesktopEditor/graphics/BooleanOperations.cpp | 21 ++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/DesktopEditor/graphics/BooleanOperations.cpp b/DesktopEditor/graphics/BooleanOperations.cpp index 1e5d58890c..7c7b3fcecf 100644 --- a/DesktopEditor/graphics/BooleanOperations.cpp +++ b/DesktopEditor/graphics/BooleanOperations.cpp @@ -768,7 +768,17 @@ bool CBooleanOperations::IsSelfInters(const CGraphicsPath& p) GetIntersection(); - return !Locations.empty(); + if (Locations.empty()) + return false; + else + { + for (const auto& l : Locations) + { + if (l->Time != 0.0 && l->Time != 1.0 && l->C.Segment2.Index != l->Inters->C.Segment1.Index) + return true; + } + } + return false; } void CBooleanOperations::TraceBoolean() @@ -2338,17 +2348,19 @@ CGraphicsPath CalcBooleanOperation(const CGraphicsPath& path1, std::vector paths1 = path1.GetSubPaths(), paths2 = path2.GetSubPaths(), paths; - + int skip_end1 = -1; for (size_t i = 0; i < paths2.size(); i++) { + int skip_end2 = -1; CBooleanOperations o; - if (o.IsSelfInters(paths2[i])) + if (o.IsSelfInters(paths2[i]) && i > skip_end2) { CBooleanOperations operation(paths2[i], paths2[i], Intersection, fillType, isLuminosity); CGraphicsPath p = std::move(operation.GetResult()); std::vector tmp_paths = p.GetSubPaths(); paths2[i] = tmp_paths[0]; + skip_end2 = i + tmp_paths.size() - 1; for (size_t k = 1; k < tmp_paths.size(); k++) paths2.insert(paths2.begin() + i + k, tmp_paths[k]); } @@ -2356,13 +2368,14 @@ CGraphicsPath CalcBooleanOperation(const CGraphicsPath& path1, for (size_t j = 0; j < paths1.size(); j++) { CBooleanOperations o2; - if (o2.IsSelfInters(paths1[j])) + if (o2.IsSelfInters(paths1[j]) && j > skip_end1) { CBooleanOperations operation(paths1[j], paths1[j], Intersection, fillType, isLuminosity); CGraphicsPath p = std::move(operation.GetResult()); std::vector tmp_paths = p.GetSubPaths(); paths1[j] = tmp_paths[0]; + skip_end1 = j + tmp_paths.size() - 1; for (size_t k = 1; k < tmp_paths.size(); k++) paths1.insert(paths1.begin() + i + k, tmp_paths[k]); }