sides[recLevel] = Side.LEFT; recLevel++; goLeft(); } } // this is a bit of a hack. It returns -1 if we're not on a leaf, and // the length of the leaf if we are on a leaf. private float onLeaf() { float[] curve = recCurveStack[recLevel]; float polyLen = 0; float x0 = curve[0], y0 = curve[1]; for (int i = 2; i < curveType; i += 2) { final float x1 = curve[i], y1 = curve[i+1]; final float len = Helpers.linelen(x0, y0, x1, y1); polyLen += len; curLeafCtrlPolyLengths[i/2 - 1] = len; x0 = x1; y0 = y1; } final float lineLen = Helpers.linelen(curve[0], curve[1], curve[curveType-2], curve[curveType-1]); if (polyLen - lineLen < ERR || recLevel == limit) { return (polyLen + lineLen)/2; } return -1; } } @Override public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) { curCurvepts[0] = x0; curCurvepts[1] = y0; curCurvepts[2] = x1; curCurvepts[3] = y1; curCurvepts[4] = x2; curCurvepts[5] = y2; curCurvepts[6] = x3; curCurvepts[7] = y3; somethingTo(8); } @Override public void quadTo(float x1, float y1, float x2, float y2) { curCurvepts[0] = x0; curCurvepts[1] = y0; curCurvepts[2] = x1; curCurvepts[3] = y1; curCurvepts[4] = x2; curCurvepts[5] = y2; somethingTo(6); } public void closePath() { lineTo(sx, sy); if (firstSegidx > 0) { if (!dashOn || needsMoveTo) { out.moveTo(sx, sy); } emitFirstSegments(); } moveTo(sx, sy); } public void pathDone() { if (firstSegidx > 0) { out.moveTo(sx, sy); emitFirstSegments(); } out.pathDone(); } @Override public long getNativeConsumer() { throw new InternalError("Dasher does not use a native consumer"); }} Lines 501–575 of 575. Previous lines
sides[recLevel] = Side.LEFT; recLevel++; goLeft(); } } // this is a bit of a hack. It returns -1 if we're not on a leaf, and // the length of the leaf if we are on a leaf. private float onLeaf() { float[] curve = recCurveStack[recLevel]; float polyLen = 0; float x0 = curve[0], y0 = curve[1]; for (int i = 2; i < curveType; i += 2) { final float x1 = curve[i], y1 = curve[i+1]; final float len = Helpers.linelen(x0, y0, x1, y1); polyLen += len; curLeafCtrlPolyLengths[i/2 - 1] = len; x0 = x1; y0 = y1; } final float lineLen = Helpers.linelen(curve[0], curve[1], curve[curveType-2], curve[curveType-1]); if (polyLen - lineLen < ERR || recLevel == limit) { return (polyLen + lineLen)/2; } return -1; } } @Override public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) { curCurvepts[0] = x0; curCurvepts[1] = y0; curCurvepts[2] = x1; curCurvepts[3] = y1; curCurvepts[4] = x2; curCurvepts[5] = y2; curCurvepts[6] = x3; curCurvepts[7] = y3; somethingTo(8); } @Override public void quadTo(float x1, float y1, float x2, float y2) { curCurvepts[0] = x0; curCurvepts[1] = y0; curCurvepts[2] = x1; curCurvepts[3] = y1; curCurvepts[4] = x2; curCurvepts[5] = y2; somethingTo(6); } public void closePath() { lineTo(sx, sy); if (firstSegidx > 0) { if (!dashOn || needsMoveTo) { out.moveTo(sx, sy); } emitFirstSegments(); } moveTo(sx, sy); } public void pathDone() { if (firstSegidx > 0) { out.moveTo(sx, sy); emitFirstSegments(); } out.pathDone(); } @Override public long getNativeConsumer() { throw new InternalError("Dasher does not use a native consumer"); } }