You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by dv...@apache.org on 2007/03/11 15:33:03 UTC

svn commit: r516909 - /xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/RadialGradientPaintContext.java

Author: dvholten
Date: Sun Mar 11 07:33:02 2007
New Revision: 516909

URL: http://svn.apache.org/viewvc?view=rev&rev=516909
Log:
enforce the use of float in calculateFixedPointSqrtLookupTable() and some comparisons

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/RadialGradientPaintContext.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/RadialGradientPaintContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/RadialGradientPaintContext.java?view=diff&rev=516909&r1=516908&r2=516909
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/RadialGradientPaintContext.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/RadialGradientPaintContext.java Sun Mar 11 07:33:02 2007
@@ -70,7 +70,7 @@
     private int fillMethod;
 
     /** Amount for offset when clamping focus. */
-    private static final float SCALEBACK = .999f;
+    private static final float SCALEBACK = 0.999f;
 
     /**
      * Constructor for RadialGradientPaintContext.
@@ -356,8 +356,8 @@
      */
     private void calculateFixedPointSqrtLookupTable() {
         float sqStepFloat;
-        sqStepFloat = ((fastGradientArraySize  * fastGradientArraySize)
-                       / (MAX_PRECISION - 2));
+        sqStepFloat = (float)((fastGradientArraySize * fastGradientArraySize)
+                       / (MAX_PRECISION - 2.0));
 
         // The last two values are the same so that linear square root
         // interpolation can happen on the maximum reachable element in the
@@ -368,7 +368,7 @@
             workTbl[i] = (int)(Math.sqrt(i*sqStepFloat));
         }
         workTbl[i] = workTbl[i-1];
-        invSqStepFloat = 1/sqStepFloat;
+        invSqStepFloat = 1.0f/sqStepFloat;
     }
 
     /** Fill the raster, cycling the gradient colors when a point falls outside
@@ -429,8 +429,8 @@
             for (i = 0; i < w; i++) {
 
                 // special case to avoid divide by zero or very near zero
-                if (((X-focusX)>-0.000001) &&
-                    ((X-focusX)< 0.000001)) {
+                if (((X-focusX)>-0.000001f) &&
+                    ((X-focusX)< 0.000001f)) {
                     solutionX = focusX;
 
                     solutionY = centerY;
@@ -556,8 +556,8 @@
             final float dx = X - focusX;
 
             // special case to avoid divide by zero or very near zero
-            if ( ( dx >-0.000001 ) &&
-                 ( dx < 0.000001 ))  {
+            if ( ( dx >-0.000001f ) &&
+                 ( dx < 0.000001f ))  {
                 solutionX = focusX;
                 solutionY = centerY;
                 solutionY += (Y > focusY)?trivial:-trivial;
@@ -634,8 +634,8 @@
 
             float dx = X - focusX;
             // special case to avoid divide by zero or very near zero
-            if ( ( dx >-0.000001 ) &&
-                 ( dx < 0.000001 ))  {
+            if ( ( dx >-0.000001f ) &&
+                 ( dx < 0.000001f ))  {
                 solutionX = focusX;
                 solutionY = centerY;
                 solutionY += (Y > focusY)?trivial:-trivial;
@@ -707,8 +707,8 @@
 
                 dx = X - focusX;
                 // special case to avoid divide by zero or very near zero
-                if ( ( dx >-0.000001 ) &&
-                     ( dx < 0.000001 ))  {
+                if ( ( dx >-0.000001f ) &&
+                     ( dx < 0.000001f ))  {
                     solutionX = focusX;
                     solutionY = centerY;
                     solutionY += (Y > focusY)?trivial:-trivial;