2005-10-24 Peter Dennis Bartok <pbartok@novell.com>
[mono.git] / mcs / class / System.Drawing / System.Drawing / Pen.jvm.cs
index d0b6fc585fe2a7227fff269a55f950e0d4fc0b3d..54c61ffcdd9411cb0d4acbfc7f2b8ce1e6cbfc16 100755 (executable)
@@ -213,7 +213,7 @@ namespace System.Drawing
                {
                        get \r
                        {
-                               return _dashPattern;
+                               return (float [])_dashPattern.Clone();
                        }
 
                        set \r
@@ -471,19 +471,22 @@ namespace System.Drawing
 \r
                        switch (DashStyle) {\r
                                case DashStyle.Custom:\r
-                                       if (DashPattern != null) {\r
-                                               dashPattern = new float[DashPattern.Length];\r
-                                               for(int i = 0; i < DashPattern.Length; i++) {
+                                       if (_dashPattern != null) {\r
+                                               dashPattern = new float[_dashPattern.Length];\r
+                                               for(int i = 0; i < _dashPattern.Length; i++) {
 
                                                        if (EndCap == LineCap.Flat)
-                                                               dashPattern[i] = DashPattern[i] * Width;
+                                                               dashPattern[i] = _dashPattern[i] * Width;
                                                        else {
-                                                               if ((i & 1) == 0)
+                                                               if ((i & 1) == 0) {
                                                                        // remove the size of caps from the opaque parts
-                                                                       dashPattern[i] = (DashPattern[i] * Width) - Width;
+                                                                       dashPattern[i] = (_dashPattern[i] * Width) - Width;
+                                                                       if (_dashPattern[i] < 0)
+                                                                               dashPattern[i] = 0;
+                                                               }
                                                                else
                                                                        // add the size of caps to the transparent parts
-                                                                       dashPattern[i] = (DashPattern[i] * Width) + Width;
+                                                                       dashPattern[i] = (_dashPattern[i] * Width) + Width;
                                                        }
                                                }\r
                                        }\r