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
6dc64444
Kaydet (Commit)
6dc64444
authored
Mar 28, 2014
tarafından
Armin Le Grand
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
i124313 At SVG import, try to optimize used CLipRegions
üst
cc82ca40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
9 deletions
+69
-9
svgclippathnode.cxx
svgio/source/svgreader/svgclippathnode.cxx
+69
-9
No files found.
svgio/source/svgreader/svgclippathnode.cxx
Dosyayı görüntüle @
6dc64444
...
...
@@ -29,6 +29,7 @@
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/processor2d/contourextractor2d.hxx>
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
//////////////////////////////////////////////////////////////////////////////
...
...
@@ -179,16 +180,75 @@ namespace svgio
aContentRange
.
getMinimum
()));
}
// redefine target. Use MaskPrimitive2D with created clip
// geometry. Using the automatically set mbIsClipPathContent at
// SvgStyleAttributes the clip definition is without fill, stroke,
// and strokeWidth and forced to black
const
drawinglayer
::
primitive2d
::
Primitive2DReference
xEmbedTransparence
(
new
drawinglayer
::
primitive2d
::
MaskPrimitive2D
(
aClipPolyPolygon
,
rContent
));
// #124313# try to avoid creating an embedding to a MaskPrimitive2D if
// possible; MaskPrimitive2D processing is potentially expensive
bool
bCreateEmbedding
(
true
);
bool
bAddContent
(
true
);
rContent
=
drawinglayer
::
primitive2d
::
Primitive2DSequence
(
&
xEmbedTransparence
,
1
);
if
(
basegfx
::
tools
::
isRectangle
(
aClipPolyPolygon
))
{
// ClipRegion is a rectangle, thus it is not expensive to tell
// if the content is completely inside or outside of it; get ranges
const
basegfx
::
B2DRange
aClipRange
(
aClipPolyPolygon
.
getB2DRange
());
const
basegfx
::
B2DRange
aContentRange
(
drawinglayer
::
primitive2d
::
getB2DRangeFromPrimitive2DSequence
(
rContent
,
aViewInformation2D
));
if
(
aClipRange
.
isInside
(
aContentRange
))
{
// completely contained, no need to clip at all, so no need for embedding
bCreateEmbedding
=
false
;
}
else
if
(
aClipRange
.
overlaps
(
aContentRange
))
{
// overlap; embedding needed. ClipRegion can be minimized by using
// the intersection of the ClipRange and the ContentRange. Minimizing
// the ClipRegion potentially enhances further processing since
// usually clip operations are expensive.
basegfx
::
B2DRange
aCommonRange
(
aContentRange
);
aCommonRange
.
intersect
(
aClipRange
);
aClipPolyPolygon
=
basegfx
::
B2DPolyPolygon
(
basegfx
::
tools
::
createPolygonFromRect
(
aCommonRange
));
}
else
{
// not inside and no overlap -> completely outside
// no need for embedding, no need for content at all
bCreateEmbedding
=
false
;
bAddContent
=
false
;
}
}
else
{
// ClipRegion is not a simple rectangle, it would be possible but expensive to
// tell if the content needs clipping or not. It is also dependent of
// the content's decomposition. To do this, a processor would be needed that
// is capable if processing the given sequence of primitives and decide
// if all is inside or all is outside. Such a ClipProcessor could be written,
// but for now just create the embedding
}
if
(
bCreateEmbedding
)
{
// redefine target. Use MaskPrimitive2D with created clip
// geometry. Using the automatically set mbIsClipPathContent at
// SvgStyleAttributes the clip definition is without fill, stroke,
// and strokeWidth and forced to black
const
drawinglayer
::
primitive2d
::
Primitive2DReference
xEmbedTransparence
(
new
drawinglayer
::
primitive2d
::
MaskPrimitive2D
(
aClipPolyPolygon
,
rContent
));
rContent
=
drawinglayer
::
primitive2d
::
Primitive2DSequence
(
&
xEmbedTransparence
,
1
);
}
else
{
if
(
!
bAddContent
)
{
rContent
.
realloc
(
0
);
}
}
}
else
{
...
...
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