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
13d66a39
Unverified
Commit
13d66a39
authored
Dec 30, 2018
by
mrbean-bremen
Browse files
Handle dasharray with odd number of elements by repeating them
- fixes #58
parent
b2357c33
Changes
3
Show whitespace changes
Inline
Side-by-side
Source/Basic Shapes/SvgVisualElement.cs
View file @
13d66a39
...
@@ -251,6 +251,11 @@ namespace Svg
...
@@ -251,6 +251,11 @@ namespace Svg
{
{
if
(
this
.
StrokeDashArray
!=
null
&&
this
.
StrokeDashArray
.
Count
>
0
)
if
(
this
.
StrokeDashArray
!=
null
&&
this
.
StrokeDashArray
.
Count
>
0
)
{
{
if
(
this
.
StrokeDashArray
.
Count
%
2
!=
0
)
{
// handle odd dash arrays by repeating them once
this
.
StrokeDashArray
.
AddRange
(
this
.
StrokeDashArray
);
}
/* divide by stroke width - GDI behaviour that I don't quite understand yet.*/
/* divide by stroke width - GDI behaviour that I don't quite understand yet.*/
pen
.
DashPattern
=
this
.
StrokeDashArray
.
ConvertAll
(
u
=>
((
u
.
ToDeviceValue
(
renderer
,
UnitRenderingType
.
Other
,
this
)
<=
0
)
?
1
:
u
.
ToDeviceValue
(
renderer
,
UnitRenderingType
.
Other
,
this
))
/
pen
.
DashPattern
=
this
.
StrokeDashArray
.
ConvertAll
(
u
=>
((
u
.
ToDeviceValue
(
renderer
,
UnitRenderingType
.
Other
,
this
)
<=
0
)
?
1
:
u
.
ToDeviceValue
(
renderer
,
UnitRenderingType
.
Other
,
this
))
/
((
strokeWidth
<=
0
)
?
1
:
strokeWidth
)).
ToArray
();
((
strokeWidth
<=
0
)
?
1
:
strokeWidth
)).
ToArray
();
...
...
Tests/Svg.UnitTests/PassingTests.csv
View file @
13d66a39
...
@@ -50,6 +50,7 @@ painting-fill-05-b
...
@@ -50,6 +50,7 @@ painting-fill-05-b
painting-stroke-01-t
painting-stroke-01-t
painting-stroke-02-t
painting-stroke-02-t
painting-stroke-04-t
painting-stroke-04-t
painting-stroke-06-t
painting-stroke-09-t
painting-stroke-09-t
painting-stroke-10-t
painting-stroke-10-t
paths-data-01-t
paths-data-01-t
...
...
Tests/W3CTestSuite/PassingTests.txt
View file @
13d66a39
...
@@ -39,6 +39,7 @@ masking-path-06-b.svg
...
@@ -39,6 +39,7 @@ masking-path-06-b.svg
masking-path-03-b.svg
masking-path-03-b.svg
metadata-example-01-t.svg
metadata-example-01-t.svg
painting-control-04-f.svg
painting-control-04-f.svg
painting-stroke-06-t.svg
painting-stroke-09-t.svg
painting-stroke-09-t.svg
painting-stroke-10-t.svg
painting-stroke-10-t.svg
pservers-grad-01-b.svg
pservers-grad-01-b.svg
...
...
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