src/java.desktop/share/classes/sun/java2d/marlin/Stroker.java
changeset 57929 13178f7e75d5
parent 51933 4ec74929fbfe
equal deleted inserted replaced
57928:f95327be136a 57929:13178f7e75d5
   540             if (orCode != 0) {
   540             if (orCode != 0) {
   541                 final int sideCode = outcode0 & outcode1;
   541                 final int sideCode = outcode0 & outcode1;
   542 
   542 
   543                 // basic rejection criteria:
   543                 // basic rejection criteria:
   544                 if (sideCode == 0) {
   544                 if (sideCode == 0) {
   545                     // ovelap clip:
   545                     // overlap clip:
   546                     if (subdivide) {
   546                     if (subdivide) {
   547                         // avoid reentrance
   547                         // avoid reentrance
   548                         subdivide = false;
   548                         subdivide = false;
   549                         // subdivide curve => callback with subdivided parts:
   549                         // subdivide curve => callback with subdivided parts:
   550                         boolean ret = curveSplitter.splitLine(cx0, cy0, x1, y1,
   550                         boolean ret = curveSplitter.splitLine(cx0, cy0, x1, y1,
   634         }
   634         }
   635         // Ignore caps like finish(false)
   635         // Ignore caps like finish(false)
   636         emitReverse();
   636         emitReverse();
   637 
   637 
   638         this.prev = CLOSE;
   638         this.prev = CLOSE;
       
   639         this.cx0 = sx0;
       
   640         this.cy0 = sy0;
       
   641         this.cOutCode = sOutCode;
   639 
   642 
   640         if (opened) {
   643         if (opened) {
   641             // do not emit close
   644             // do not emit close
   642             opened = false;
   645             opened = false;
   643         } else {
   646         } else {
   668     private void finish(final int outcode) {
   671     private void finish(final int outcode) {
   669         // Problem: impossible to guess if the path will be closed in advance
   672         // Problem: impossible to guess if the path will be closed in advance
   670         //          i.e. if caps must be drawn or not ?
   673         //          i.e. if caps must be drawn or not ?
   671         // Solution: use the ClosedPathDetector before Stroker to determine
   674         // Solution: use the ClosedPathDetector before Stroker to determine
   672         // if the path is a closed path or not
   675         // if the path is a closed path or not
   673         if (!rdrCtx.closedPath) {
   676         if (rdrCtx.closedPath) {
       
   677             emitReverse();
       
   678         } else {
   674             if (outcode == 0) {
   679             if (outcode == 0) {
   675                 // current point = end's cap:
   680                 // current point = end's cap:
   676                 if (capStyle == CAP_ROUND) {
   681                 if (capStyle == CAP_ROUND) {
   677                     drawRoundCap(cx0, cy0, cmx, cmy);
   682                     drawRoundCap(cx0, cy0, cmx, cmy);
   678                 } else if (capStyle == CAP_SQUARE) {
   683                 } else if (capStyle == CAP_SQUARE) {
   693                         emitLineTo(sx0 + smy - smx, sy0 - smx - smy);
   698                         emitLineTo(sx0 + smy - smx, sy0 - smx - smy);
   694                         emitLineTo(sx0 + smy + smx, sy0 - smx + smy);
   699                         emitLineTo(sx0 + smy + smx, sy0 - smx + smy);
   695                     }
   700                     }
   696                 }
   701                 }
   697             }
   702             }
   698         } else {
       
   699             emitReverse();
       
   700         }
   703         }
   701         emitClose();
   704         emitClose();
   702     }
   705     }
   703 
   706 
   704     private void emitMoveTo(final float x0, final float y0) {
   707     private void emitMoveTo(final float x0, final float y0) {
  1058             if (orCode != 0) {
  1061             if (orCode != 0) {
  1059                 final int sideCode = outcode0 & outcode1 & outcode2 & outcode3;
  1062                 final int sideCode = outcode0 & outcode1 & outcode2 & outcode3;
  1060 
  1063 
  1061                 // basic rejection criteria:
  1064                 // basic rejection criteria:
  1062                 if (sideCode == 0) {
  1065                 if (sideCode == 0) {
  1063                     // ovelap clip:
  1066                     // overlap clip:
  1064                     if (subdivide) {
  1067                     if (subdivide) {
  1065                         // avoid reentrance
  1068                         // avoid reentrance
  1066                         subdivide = false;
  1069                         subdivide = false;
  1067                         // subdivide curve => callback with subdivided parts:
  1070                         // subdivide curve => callback with subdivided parts:
  1068                         boolean ret = curveSplitter.splitCurve(cx0, cy0, x1, y1,
  1071                         boolean ret = curveSplitter.splitCurve(cx0, cy0, x1, y1,
  1206             if (orCode != 0) {
  1209             if (orCode != 0) {
  1207                 final int sideCode = outcode0 & outcode1 & outcode2;
  1210                 final int sideCode = outcode0 & outcode1 & outcode2;
  1208 
  1211 
  1209                 // basic rejection criteria:
  1212                 // basic rejection criteria:
  1210                 if (sideCode == 0) {
  1213                 if (sideCode == 0) {
  1211                     // ovelap clip:
  1214                     // overlap clip:
  1212                     if (subdivide) {
  1215                     if (subdivide) {
  1213                         // avoid reentrance
  1216                         // avoid reentrance
  1214                         subdivide = false;
  1217                         subdivide = false;
  1215                         // subdivide curve => call lineTo() with subdivided curves:
  1218                         // subdivide curve => call lineTo() with subdivided curves:
  1216                         boolean ret = curveSplitter.splitQuad(cx0, cy0, x1, y1,
  1219                         boolean ret = curveSplitter.splitQuad(cx0, cy0, x1, y1,