src/share/classes/sun/awt/geom/Order3.java

Print this page
rev 9717 : 8039642: Fix raw and unchecked warnings in sun.awt.*
Reviewed-by:


  36     private double cx0;
  37     private double cy0;
  38     private double cx1;
  39     private double cy1;
  40     private double x1;
  41     private double y1;
  42 
  43     private double xmin;
  44     private double xmax;
  45 
  46     private double xcoeff0;
  47     private double xcoeff1;
  48     private double xcoeff2;
  49     private double xcoeff3;
  50 
  51     private double ycoeff0;
  52     private double ycoeff1;
  53     private double ycoeff2;
  54     private double ycoeff3;
  55 
  56     public static void insert(Vector curves, double tmp[],
  57                               double x0, double y0,
  58                               double cx0, double cy0,
  59                               double cx1, double cy1,
  60                               double x1, double y1,
  61                               int direction)
  62     {
  63         int numparams = getHorizontalParams(y0, cy0, cy1, y1, tmp);
  64         if (numparams == 0) {
  65             // We are using addInstance here to avoid inserting horisontal
  66             // segments
  67             addInstance(curves, x0, y0, cx0, cy0, cx1, cy1, x1, y1, direction);
  68             return;
  69         }
  70         // Store coordinates for splitting at tmp[3..10]
  71         tmp[3] = x0;  tmp[4]  = y0;
  72         tmp[5] = cx0; tmp[6]  = cy0;
  73         tmp[7] = cx1; tmp[8]  = cy1;
  74         tmp[9] = x1;  tmp[10] = y1;
  75         double t = tmp[0];
  76         if (numparams > 1 && t > tmp[1]) {


  88         int index = 3;
  89         if (direction == DECREASING) {
  90             index += numparams * 6;
  91         }
  92         while (numparams >= 0) {
  93             addInstance(curves,
  94                         tmp[index + 0], tmp[index + 1],
  95                         tmp[index + 2], tmp[index + 3],
  96                         tmp[index + 4], tmp[index + 5],
  97                         tmp[index + 6], tmp[index + 7],
  98                         direction);
  99             numparams--;
 100             if (direction == INCREASING) {
 101                 index += 6;
 102             } else {
 103                 index -= 6;
 104             }
 105         }
 106     }
 107 
 108     public static void addInstance(Vector curves,
 109                                    double x0, double y0,
 110                                    double cx0, double cy0,
 111                                    double cx1, double cy1,
 112                                    double x1, double y1,
 113                                    int direction) {
 114         if (y0 > y1) {
 115             curves.add(new Order3(x1, y1, cx1, cy1, cx0, cy0, x0, y0,
 116                                   -direction));
 117         } else if (y1 > y0) {
 118             curves.add(new Order3(x0, y0, cx0, cy0, cx1, cy1, x1, y1,
 119                                   direction));
 120         }
 121     }
 122 
 123     /*
 124      * Return the count of the number of horizontal sections of the
 125      * specified cubic Bezier curve.  Put the parameters for the
 126      * horizontal sections into the specified <code>ret</code> array.
 127      * <p>
 128      * If we examine the parametric equation in t, we have:




  36     private double cx0;
  37     private double cy0;
  38     private double cx1;
  39     private double cy1;
  40     private double x1;
  41     private double y1;
  42 
  43     private double xmin;
  44     private double xmax;
  45 
  46     private double xcoeff0;
  47     private double xcoeff1;
  48     private double xcoeff2;
  49     private double xcoeff3;
  50 
  51     private double ycoeff0;
  52     private double ycoeff1;
  53     private double ycoeff2;
  54     private double ycoeff3;
  55 
  56     public static void insert(Vector<? super Order3> curves, double tmp[],
  57                               double x0, double y0,
  58                               double cx0, double cy0,
  59                               double cx1, double cy1,
  60                               double x1, double y1,
  61                               int direction)
  62     {
  63         int numparams = getHorizontalParams(y0, cy0, cy1, y1, tmp);
  64         if (numparams == 0) {
  65             // We are using addInstance here to avoid inserting horisontal
  66             // segments
  67             addInstance(curves, x0, y0, cx0, cy0, cx1, cy1, x1, y1, direction);
  68             return;
  69         }
  70         // Store coordinates for splitting at tmp[3..10]
  71         tmp[3] = x0;  tmp[4]  = y0;
  72         tmp[5] = cx0; tmp[6]  = cy0;
  73         tmp[7] = cx1; tmp[8]  = cy1;
  74         tmp[9] = x1;  tmp[10] = y1;
  75         double t = tmp[0];
  76         if (numparams > 1 && t > tmp[1]) {


  88         int index = 3;
  89         if (direction == DECREASING) {
  90             index += numparams * 6;
  91         }
  92         while (numparams >= 0) {
  93             addInstance(curves,
  94                         tmp[index + 0], tmp[index + 1],
  95                         tmp[index + 2], tmp[index + 3],
  96                         tmp[index + 4], tmp[index + 5],
  97                         tmp[index + 6], tmp[index + 7],
  98                         direction);
  99             numparams--;
 100             if (direction == INCREASING) {
 101                 index += 6;
 102             } else {
 103                 index -= 6;
 104             }
 105         }
 106     }
 107 
 108     public static void addInstance(Vector<? super Order3> curves,
 109                                    double x0, double y0,
 110                                    double cx0, double cy0,
 111                                    double cx1, double cy1,
 112                                    double x1, double y1,
 113                                    int direction) {
 114         if (y0 > y1) {
 115             curves.add(new Order3(x1, y1, cx1, cy1, cx0, cy0, x0, y0,
 116                                   -direction));
 117         } else if (y1 > y0) {
 118             curves.add(new Order3(x0, y0, cx0, cy0, cx1, cy1, x1, y1,
 119                                   direction));
 120         }
 121     }
 122 
 123     /*
 124      * Return the count of the number of horizontal sections of the
 125      * specified cubic Bezier curve.  Put the parameters for the
 126      * horizontal sections into the specified <code>ret</code> array.
 127      * <p>
 128      * If we examine the parametric equation in t, we have: