Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
a826856b
Commit
a826856b
authored
Nov 01, 2010
by
owaits
Browse files
Correctly caches the clip path and re-generates if dirty.
parent
898d89e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/Clipping and Masking/SvgClipPath.cs
View file @
a826856b
...
@@ -28,25 +28,27 @@ namespace Svg
...
@@ -28,25 +28,27 @@ namespace Svg
this
.
ClipPathUnits
=
SvgCoordinateUnits
.
ObjectBoundingBox
;
this
.
ClipPathUnits
=
SvgCoordinateUnits
.
ObjectBoundingBox
;
}
}
private
GraphicsPath
cachedClipPath
=
null
;
/// <summary>
/// <summary>
/// Gets this <see cref="SvgClipPath"/>'s region to be used as a clipping region.
/// Gets this <see cref="SvgClipPath"/>'s region to be used as a clipping region.
/// </summary>
/// </summary>
/// <returns>A new <see cref="Region"/> containing the <see cref="Region"/> to be used for clipping.</returns>
/// <returns>A new <see cref="Region"/> containing the <see cref="Region"/> to be used for clipping.</returns>
public
Region
GetClipRegion
(
SvgVisualElement
owner
)
public
Region
GetClipRegion
(
SvgVisualElement
owner
)
{
{
var
path
=
new
GraphicsPath
();
if
(
cachedClipPath
==
null
||
this
.
_pathDirty
)
if
(
this
.
_pathDirty
)
{
{
cachedClipPath
=
new
GraphicsPath
();
foreach
(
SvgElement
element
in
this
.
Children
)
foreach
(
SvgElement
element
in
this
.
Children
)
{
{
this
.
CombinePaths
(
p
ath
,
element
);
this
.
CombinePaths
(
cachedClipP
ath
,
element
);
}
}
this
.
_pathDirty
=
false
;
this
.
_pathDirty
=
false
;
}
}
return
new
Region
(
p
ath
);
return
new
Region
(
cachedClipP
ath
);
}
}
/// <summary>
/// <summary>
...
...
Write
Preview
Supports
Markdown
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