< prev index next >

modules/javafx.graphics/src/main/java/com/sun/marlin/RendererNoAA.java

Print this page

        

@@ -57,20 +57,21 @@
     public static final int SIZEOF_EDGE_BYTES = (int)(OFF_YMAX + SIZE_INT);
 
     // curve break into lines
     // cubic error in subpixels to decrement step
     private static final float CUB_DEC_ERR_SUBPIX
-        = 1f * (1f / 8f); // 1 pixel for typical 1x1 subpixels
+        = 1f * (1f / 8f); // 1 pixel
     // cubic error in subpixels to increment step
     private static final float CUB_INC_ERR_SUBPIX
-        = 0.4f * (1f / 8f); // 0.4 pixel for typical 1x1 subpixels
+        = 0.4f * (1f / 8f); // 0.4 pixel
 
-    // cubic bind length to decrement step = 8 * error in subpixels
-    // multiply by 8 = error scale factor:
+    // bad paths (59294/100000 == 59,29%, 94335 bad pixels (avg = 1,59), 3966 warnings (avg = 0,07)
+
+    // cubic bind length to decrement step
     public static final float CUB_DEC_BND
         = 8f * CUB_DEC_ERR_SUBPIX;
-    // cubic bind length to increment step = 8 * error in subpixels
+    // cubic bind length to increment step
     public static final float CUB_INC_BND
         = 8f * CUB_INC_ERR_SUBPIX;
 
     // cubic countlg
     public static final int CUB_COUNT_LG = 2;

@@ -88,13 +89,15 @@
     private static final float CUB_INV_COUNT_3 = 1f / CUB_COUNT_3;
 
     // quad break into lines
     // quadratic error in subpixels
     private static final float QUAD_DEC_ERR_SUBPIX
-        = 1f * (1f / 8f); // 1 pixel for typical 1x1 subpixels
+        = 0.5f * (1f / 8f); // 0.5 pixel
+
+    // bad paths (62916/100000 == 62,92%, 103818 bad pixels (avg = 1,65), 6514 warnings (avg = 0,10)
 
-    // quadratic bind length to decrement step = 8 * error in subpixels
+    // quadratic bind length to decrement step
     public static final float QUAD_DEC_BND
         = 8f * QUAD_DEC_ERR_SUBPIX;
 
 //////////////////////////////////////////////////////////////////////////////
 //  SCAN LINE

@@ -157,11 +160,11 @@
                                           final float x2, final float y2)
     {
         int count = 1; // dt = 1 / count
 
         // maximum(ddX|Y) = norm(dbx, dby) * dt^2 (= 1)
-        float maxDD = FloatMath.max(Math.abs(c.dbx), Math.abs(c.dby));
+        float maxDD = Math.abs(c.dbx) + Math.abs(c.dby);
 
         final float _DEC_BND = QUAD_DEC_BND;
 
         while (maxDD >= _DEC_BND) {
             // divide step by half:

@@ -236,11 +239,11 @@
         final float _DEC_BND = CUB_DEC_BND;
         final float _INC_BND = CUB_INC_BND;
 
         while (count > 0) {
             // divide step by half:
-            while (Math.abs(ddx) >= _DEC_BND || Math.abs(ddy) >= _DEC_BND) {
+            while (Math.abs(ddx) + Math.abs(ddy) >= _DEC_BND) {
                 dddx /= 8f;
                 dddy /= 8f;
                 ddx = ddx/4f - dddx;
                 ddy = ddy/4f - dddy;
                 dx = (dx - ddx) / 2f;

@@ -256,11 +259,11 @@
             // TODO: why use first derivative dX|Y instead of second ddX|Y ?
             // both scale changes should use speed or acceleration to have the same metric.
 
             // can only do this on even "count" values, because we must divide count by 2
             while (count % 2 == 0
-                   && Math.abs(dx) <= _INC_BND && Math.abs(dy) <= _INC_BND)
+                   && Math.abs(dx) + Math.abs(dy) <= _INC_BND)
             {
                 dx = 2f * dx + ddx;
                 dy = 2f * dy + ddy;
                 ddx = 4f * (ddx + dddx);
                 ddy = 4f * (ddy + dddy);
< prev index next >