[mapguide-commits] r1289 - trunk/MgDev/Common/Stylization

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Mar 19 14:06:16 EDT 2007


Author: traianstanev
Date: 2007-03-19 14:06:15 -0400 (Mon, 19 Mar 2007)
New Revision: 1289

Modified:
   trunk/MgDev/Common/Stylization/SE_Renderer.cpp
Log:
Replaced two divisions by a single division and two mults.

Modified: trunk/MgDev/Common/Stylization/SE_Renderer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_Renderer.cpp	2007-03-19 17:50:38 UTC (rev 1288)
+++ trunk/MgDev/Common/Stylization/SE_Renderer.cpp	2007-03-19 18:06:15 UTC (rev 1289)
@@ -285,22 +285,14 @@
 
             //check if completely skipping current segment since it is smaller than
             //the increment
-            if (drawpos < len)
+            if (drawpos < len && len > 0.0)
             {
                 //compute linear deltas for x and y directions
                 // -- we will use these to quickly move along the line
                 //without having to do too much math
-                double dx_incr, dy_incr;
-                if (len > 0.0)
-                {
-                    dx_incr = dx / len;
-                    dy_incr = dy / len;
-                }
-                else
-                {
-                    dx_incr = 1.0;
-                    dy_incr = 0.0;
-                }
+                double invlen = 1.0 / len;
+                double dx_incr = dx * invlen;
+                double dy_incr = dy * invlen;
 
                 double symrot = fromAngle? style->angle : atan2(dy, dx);
                 double tx = seg_screen[0] + dx_incr * drawpos;



More information about the mapguide-commits mailing list