* Matrix.cs (ToString): Cache the elements inside a local variable
authorDuncan Mak <duncan@mono-cvs.ximian.com>
Thu, 25 Dec 2003 07:39:23 +0000 (07:39 -0000)
committerDuncan Mak <duncan@mono-cvs.ximian.com>
Thu, 25 Dec 2003 07:39:23 +0000 (07:39 -0000)
to avoid calling the Elements property repeatedly.

* graphics-path.c (GdipAddPathLine): Use append instead of
append_point.
(GdipTransformPath): Remember to reset the points after the
transformation.

svn path=/trunk/mcs/; revision=21485

mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs
mcs/class/System.Drawing/gdiplus/ChangeLog
mcs/class/System.Drawing/gdiplus/graphics-path.c

index d218138d548152b7ff70f558ed108346d8f0f54d..779cfdf73125a3087acc1c2e9e4e55a20536db50 100644 (file)
@@ -1,3 +1,8 @@
+2003-12-25  Duncan Mak  <duncan@ximian.com>
+
+       * Matrix.cs (ToString): Cache the elements inside a local variable
+       to avoid calling the Elements property repeatedly.
+
 2003-12-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * Blend.cs: fix array sizes in the constructors. Closes bug #51564.
index d12587ab975b7276a13207fc15e0f96accafa242..74e467018a34366731c339d9595a006075b023aa 100644 (file)
@@ -154,14 +154,17 @@ namespace System.Drawing.Drawing2D
 \r
                 public override string ToString ()\r
                 {\r
+                        float [] elements = this.Elements;\r
+                        \r
                         System.Text.StringBuilder sb = new System.Text.StringBuilder ();\r
+\r
                         sb.Append ("(");\r
-                        sb.Append (Elements [0] + " ");\r
-                        sb.Append (Elements [1] + " ");\r
-                        sb.Append (Elements [2] + " ");\r
-                        sb.Append (Elements [3] + " ");\r
-                        sb.Append (Elements [4] + " ");\r
-                        sb.Append (Elements [5] + ")");                        \r
+                        sb.Append (elements [0] + " ");\r
+                        sb.Append (elements [1] + " ");\r
+                        sb.Append (elements [2] + " ");\r
+                        sb.Append (elements [3] + " ");\r
+                        sb.Append (elements [4] + " ");\r
+                        sb.Append (elements [5] + ")");                        \r
                         return sb.ToString ();\r
                 }\r
         \r
index 079dcfd09284c4a870b32a9366668a8b4930ab63..eac0211d886e7986883713061be72b0756e06212 100644 (file)
@@ -1,5 +1,12 @@
 2003-12-25  Duncan Mak  <duncan@ximian.com>
 
+       * graphics-path.c (GdipAddPathLine): Use append instead of
+       append_point.
+       (GdipTransformPath): Remember to reset the points after the
+       transformation.
+
+2003-12-25  Duncan Mak  <duncan@ximian.com>    
+
        * graphics.c (DrawBezier, DrawBezierI): Well, it's pretty obvious
        that the code was incorrect before. After Christmas, I'm gonna
        hook up the GraphicsPath code and work on testing and making sure
index 6c1b99f5289d327c97885c401e1e8ecdf5469dd4..07b0eb385761f152906f7dd93a63f37407d9167b 100644 (file)
@@ -294,10 +294,8 @@ GdipGetPathLastPoint (GpPath *path, GpPointF *lastPoint)
 GpStatus
 GdipAddPathLine (GpPath *path, float x1, float y1, float x2, float y2)
 {
-        PointF p1 = { x1, y1 };
-        PointF p2 = { x2, y2 };        
-        append_point (path, p1, PathPointTypeStart);
-        append_point (path, p2, PathPointTypeLine);
+        append (path, x1, y1, PathPointTypeStart);
+        append (path, x2, y2, PathPointTypeLine);
 
         return Ok;
 }
@@ -545,7 +543,8 @@ GdipAddPathPath (GpPath *path, GpPath *addingPath, bool connect)
 /*
  * GpStatus 
  * GdipAddString (GpPath *path, const char *string, int length, 
- *                const GpFontFamily *family, int style, float emSize, const GpRectF *layoutRect, const GpStringFormat *format)
+ *                const GpFontFamily *family, int style, float emSize, const GpRectF *layoutRect,
+ *                const GpStringFormat *format)
  * { 
  *         return NotImplemented; 
  * }
@@ -554,7 +553,8 @@ GdipAddPathPath (GpPath *path, GpPath *addingPath, bool connect)
 /*
  * GpStatus
  * GdipAddString (GpPath *path, const char *string, int length,
- *                const GpFontFamily *family, int style, float emSize, const GpRect *layoutRect, const GpStringFormat *format)
+ *                const GpFontFamily *family, int style, float emSize, const GpRect *layoutRect,
+ *                const GpStringFormat *format)
  * {
  *          return NotImplemented;
  * }
@@ -714,8 +714,11 @@ GpStatus
 GdipTransformPath (GpPath* path, GpMatrix *matrix)
 {
         PointF *points = g_array_to_array (path->points);
+
         Status s = GdipTransformMatrixPoints (matrix, points, path->count);
 
+        path->points = array_to_g_array (points);
+
         GdipFree (points);
 
         return s;