Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
a02eb39b
Kaydet (Commit)
a02eb39b
authored
Agu 06, 2014
tarafından
Armin Le Grand
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
i125349 refined to exclude possible recursive calls
üst
7c5e9b9b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
65 deletions
+71
-65
b2dpolygonclipper.cxx
basegfx/source/polygon/b2dpolygonclipper.cxx
+71
-65
No files found.
basegfx/source/polygon/b2dpolygonclipper.cxx
Dosyayı görüntüle @
a02eb39b
...
@@ -417,71 +417,6 @@ namespace basegfx
...
@@ -417,71 +417,6 @@ namespace basegfx
if
(
rCandidate
.
count
()
&&
rClip
.
count
())
if
(
rCandidate
.
count
()
&&
rClip
.
count
())
{
{
// #125349# detect if both given PolyPolygons are indeed ranges
bool
bBothRectangle
(
false
);
if
(
basegfx
::
tools
::
isRectangle
(
rCandidate
))
{
if
(
basegfx
::
tools
::
isRectangle
(
rClip
))
{
// both are ranges
bBothRectangle
=
true
;
}
else
{
// rCandidate is rectangle -> clip rClip on rRectangle, use the much
// cheaper and numerically more stable clipping against a range
// This simplification (exchanging content and clip) is valid
// since we do a logical AND operation
return
clipPolyPolygonOnRange
(
rClip
,
rCandidate
.
getB2DRange
(),
bInside
,
bStroke
);
}
}
else
if
(
basegfx
::
tools
::
isRectangle
(
rClip
))
{
if
(
basegfx
::
tools
::
isRectangle
(
rCandidate
))
{
// both are ranges
bBothRectangle
=
true
;
}
else
{
// rClip is rectangle -> clip rCandidate on rRectangle, use the much
// cheaper and numerically more stable clipping against a range
return
clipPolyPolygonOnRange
(
rCandidate
,
rClip
.
getB2DRange
(),
bInside
,
bStroke
);
}
}
if
(
bBothRectangle
)
{
// both are rectangle
if
(
rCandidate
.
getB2DRange
().
equal
(
rClip
.
getB2DRange
()))
{
// if both are equal -> no change
return
rCandidate
;
}
else
{
// not equal -> create new intersection from both ranges,
// but much cheaper based on the ranges
basegfx
::
B2DRange
aIntersectionRange
(
rCandidate
.
getB2DRange
());
aIntersectionRange
.
intersect
(
rClip
.
getB2DRange
());
if
(
aIntersectionRange
.
isEmpty
())
{
// no common IntersectionRange -> the clip will be empty
return
B2DPolyPolygon
();
}
else
{
// use common aIntersectionRange as result, convert
// to expected PolyPolygon form
return
basegfx
::
B2DPolyPolygon
(
basegfx
::
tools
::
createPolygonFromRect
(
aIntersectionRange
));
}
}
}
// one or both are no rectangle - go the hard way and clip PolyPolygon
// one or both are no rectangle - go the hard way and clip PolyPolygon
// against PolyPolygon...
// against PolyPolygon...
if
(
bStroke
)
if
(
bStroke
)
...
@@ -552,6 +487,77 @@ namespace basegfx
...
@@ -552,6 +487,77 @@ namespace basegfx
}
}
else
else
{
{
// check for simplification with ranges if !bStroke (handling as stroke is more simple),
// but also only when bInside, else the simplification may lead to recursive calls (see
// calls to clipPolyPolygonOnPolyPolygon in clipPolyPolygonOnRange and clipPolygonOnRange)
if
(
bInside
)
{
// #125349# detect if both given PolyPolygons are indeed ranges
bool
bBothRectangle
(
false
);
if
(
basegfx
::
tools
::
isRectangle
(
rCandidate
))
{
if
(
basegfx
::
tools
::
isRectangle
(
rClip
))
{
// both are ranges
bBothRectangle
=
true
;
}
else
{
// rCandidate is rectangle -> clip rClip on rRectangle, use the much
// cheaper and numerically more stable clipping against a range
// This simplification (exchanging content and clip) is valid
// since we do a logical AND operation
return
clipPolyPolygonOnRange
(
rClip
,
rCandidate
.
getB2DRange
(),
bInside
,
bStroke
);
}
}
else
if
(
basegfx
::
tools
::
isRectangle
(
rClip
))
{
if
(
basegfx
::
tools
::
isRectangle
(
rCandidate
))
{
// both are ranges
bBothRectangle
=
true
;
}
else
{
// rClip is rectangle -> clip rCandidate on rRectangle, use the much
// cheaper and numerically more stable clipping against a range
return
clipPolyPolygonOnRange
(
rCandidate
,
rClip
.
getB2DRange
(),
bInside
,
bStroke
);
}
}
if
(
bBothRectangle
)
{
// both are rectangle
if
(
rCandidate
.
getB2DRange
().
equal
(
rClip
.
getB2DRange
()))
{
// if both are equal -> no change
return
rCandidate
;
}
else
{
// not equal -> create new intersection from both ranges,
// but much cheaper based on the ranges
basegfx
::
B2DRange
aIntersectionRange
(
rCandidate
.
getB2DRange
());
aIntersectionRange
.
intersect
(
rClip
.
getB2DRange
());
if
(
aIntersectionRange
.
isEmpty
())
{
// no common IntersectionRange -> the clip will be empty
return
B2DPolyPolygon
();
}
else
{
// use common aIntersectionRange as result, convert
// to expected PolyPolygon form
return
basegfx
::
B2DPolyPolygon
(
basegfx
::
tools
::
createPolygonFromRect
(
aIntersectionRange
));
}
}
}
}
// area clipping
// area clipping
B2DPolyPolygon
aMergePolyPolygonA
(
rClip
);
B2DPolyPolygon
aMergePolyPolygonA
(
rClip
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment