< prev index next >

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

Print this page

        

*** 61,70 **** --- 61,72 ---- private static final double CUB_INC_ERR_SUBPIX = MarlinProperties.getCubicIncD1() * (1.0d / 8.0d); // 0.4 pixel // TestNonAARasterization (JDK-8170879): cubics // bad paths (59294/100000 == 59,29%, 94335 bad pixels (avg = 1,59), 3966 warnings (avg = 0,07) + // 2018 + // 1.0 / 0.2: bad paths (67194/100000 == 67,19%, 117394 bad pixels (avg = 1,75 - max = 9), 4042 warnings (avg = 0,06) // cubic bind length to decrement step public static final double CUB_DEC_BND = 8.0d * CUB_DEC_ERR_SUBPIX; // cubic bind length to increment step
*** 91,100 **** --- 93,104 ---- private static final double QUAD_DEC_ERR_SUBPIX = MarlinProperties.getQuadDecD2() * (1.0d / 8.0d); // 0.5 pixel // TestNonAARasterization (JDK-8170879): quads // bad paths (62916/100000 == 62,92%, 103818 bad pixels (avg = 1,65), 6514 warnings (avg = 0,10) + // 2018 + // 0.50px = bad paths (62915/100000 == 62,92%, 103810 bad pixels (avg = 1,65), 6512 warnings (avg = 0,10) // quadratic bind length to decrement step public static final double QUAD_DEC_BND = 8.0d * QUAD_DEC_ERR_SUBPIX;
*** 173,211 **** if (DO_STATS) { rdrCtx.stats.stat_rdr_quadBreak_dec.add(count); } } ! int nL = 0; // line count if (count > 1) { final double icount = 1.0d / count; // dt final double icount2 = icount * icount; // dt^2 final double ddx = c.dbx * icount2; final double ddy = c.dby * icount2; double dx = c.bx * icount2 + c.cx * icount; double dy = c.by * icount2 + c.cy * icount; ! double x1, y1; ! ! while (--count > 0) { ! x1 = x0 + dx; ! dx += ddx; ! y1 = y0 + dy; ! dy += ddy; addLine(x0, y0, x1, y1); - - if (DO_STATS) { nL++; } x0 = x1; y0 = y1; } } addLine(x0, y0, x2, y2); if (DO_STATS) { ! rdrCtx.stats.stat_rdr_quadBreak.add(nL + 1); } } // x0, y0 and x3,y3 are the endpoints of the curve. We could compute these // using c.xat(0),c.yat(0) and c.xat(1),c.yat(1), but this might introduce --- 177,211 ---- if (DO_STATS) { rdrCtx.stats.stat_rdr_quadBreak_dec.add(count); } } ! final int nL = count; // line count ! if (count > 1) { final double icount = 1.0d / count; // dt final double icount2 = icount * icount; // dt^2 final double ddx = c.dbx * icount2; final double ddy = c.dby * icount2; double dx = c.bx * icount2 + c.cx * icount; double dy = c.by * icount2 + c.cy * icount; ! // we use x0, y0 to walk the line ! for (double x1 = x0, y1 = y0; --count > 0; dx += ddx, dy += ddy) { ! x1 += dx; ! y1 += dy; addLine(x0, y0, x1, y1); x0 = x1; y0 = y1; } } addLine(x0, y0, x2, y2); if (DO_STATS) { ! rdrCtx.stats.stat_rdr_quadBreak.add(nL); } } // x0, y0 and x3,y3 are the endpoints of the curve. We could compute these // using c.xat(0),c.yat(0) and c.xat(1),c.yat(1), but this might introduce
*** 214,224 **** // c.set here, but then too many numbers are passed around. private void curveBreakIntoLinesAndAdd(double x0, double y0, final DCurve c, final double x3, final double y3) { ! int count = CUB_COUNT; final double icount = CUB_INV_COUNT; // dt final double icount2 = CUB_INV_COUNT_2; // dt^2 final double icount3 = CUB_INV_COUNT_3; // dt^3 // the dx and dy refer to forward differencing variables, not the last --- 214,224 ---- // c.set here, but then too many numbers are passed around. private void curveBreakIntoLinesAndAdd(double x0, double y0, final DCurve c, final double x3, final double y3) { ! int count = CUB_COUNT; final double icount = CUB_INV_COUNT; // dt final double icount2 = CUB_INV_COUNT_2; // dt^2 final double icount3 = CUB_INV_COUNT_3; // dt^3 // the dx and dy refer to forward differencing variables, not the last
*** 229,266 **** ddx = dddx + c.dbx * icount2; ddy = dddy + c.dby * icount2; dx = c.ax * icount3 + c.bx * icount2 + c.cx * icount; dy = c.ay * icount3 + c.by * icount2 + c.cy * icount; - // we use x0, y0 to walk the line - double x1 = x0, y1 = y0; int nL = 0; // line count final double _DEC_BND = CUB_DEC_BND; final double _INC_BND = CUB_INC_BND; ! while (count > 0) { ! // divide step by half: ! while (Math.abs(ddx) + Math.abs(ddy) >= _DEC_BND) { ! dddx /= 8.0d; ! dddy /= 8.0d; ! ddx = ddx / 4.0d - dddx; ! ddy = ddy / 4.0d - dddy; ! dx = (dx - ddx) / 2.0d; ! dy = (dy - ddy) / 2.0d; ! ! count <<= 1; ! if (DO_STATS) { ! rdrCtx.stats.stat_rdr_curveBreak_dec.add(count); ! } ! } // double step: // can only do this on even "count" values, because we must divide count by 2 ! while (count % 2 == 0 ! && Math.abs(dx) + Math.abs(dy) <= _INC_BND) ! { dx = 2.0d * dx + ddx; dy = 2.0d * dy + ddy; ddx = 4.0d * (ddx + dddx); ddy = 4.0d * (ddy + dddy); dddx *= 8.0d; --- 229,251 ---- ddx = dddx + c.dbx * icount2; ddy = dddy + c.dby * icount2; dx = c.ax * icount3 + c.bx * icount2 + c.cx * icount; dy = c.ay * icount3 + c.by * icount2 + c.cy * icount; int nL = 0; // line count final double _DEC_BND = CUB_DEC_BND; final double _INC_BND = CUB_INC_BND; ! // we use x0, y0 to walk the line ! for (double x1 = x0, y1 = y0; count > 0; ) { ! // inc / dec => ratio ~ 5 to minimize upscale / downscale but minimize edges // double step: // can only do this on even "count" values, because we must divide count by 2 ! while ((count % 2 == 0) ! && ((Math.abs(ddx) + Math.abs(ddy)) <= _INC_BND)) { dx = 2.0d * dx + ddx; dy = 2.0d * dy + ddy; ddx = 4.0d * (ddx + dddx); ddy = 4.0d * (ddy + dddy); dddx *= 8.0d;
*** 269,298 **** count >>= 1; if (DO_STATS) { rdrCtx.stats.stat_rdr_curveBreak_inc.add(count); } } ! if (--count > 0) { ! x1 += dx; ! dx += ddx; ! ddx += dddx; ! y1 += dy; ! dy += ddy; ! ddy += dddy; ! } else { ! x1 = x3; ! y1 = y3; } ! addLine(x0, y0, x1, y1); ! if (DO_STATS) { nL++; } x0 = x1; y0 = y1; } if (DO_STATS) { ! rdrCtx.stats.stat_rdr_curveBreak.add(nL); } } private void addLine(double x1, double y1, double x2, double y2) { if (DO_MONITORS) { --- 254,297 ---- count >>= 1; if (DO_STATS) { rdrCtx.stats.stat_rdr_curveBreak_inc.add(count); } } ! ! // divide step by half: ! while ((Math.abs(ddx) + Math.abs(ddy)) >= _DEC_BND) { ! dddx /= 8.0d; ! dddy /= 8.0d; ! ddx = ddx / 4.0d - dddx; ! ddy = ddy / 4.0d - dddy; ! dx = (dx - ddx) / 2.0d; ! dy = (dy - ddy) / 2.0d; ! ! count <<= 1; ! if (DO_STATS) { ! rdrCtx.stats.stat_rdr_curveBreak_dec.add(count); ! } ! } ! if (--count == 0) { ! break; } ! x1 += dx; ! y1 += dy; ! dx += ddx; ! dy += ddy; ! ddx += dddx; ! ddy += dddy; ! addLine(x0, y0, x1, y1); x0 = x1; y0 = y1; } + addLine(x0, y0, x3, y3); + if (DO_STATS) { ! rdrCtx.stats.stat_rdr_curveBreak.add(nL + 1); } } private void addLine(double x1, double y1, double x2, double y2) { if (DO_MONITORS) {
*** 667,678 **** final double pix_x2, final double pix_y2, final double pix_x3, final double pix_y3) { final double xe = tosubpixx(pix_x3); final double ye = tosubpixy(pix_y3); ! curve.set(x0, y0, tosubpixx(pix_x1), tosubpixy(pix_y1), ! tosubpixx(pix_x2), tosubpixy(pix_y2), xe, ye); curveBreakIntoLinesAndAdd(x0, y0, curve, xe, ye); x0 = xe; y0 = ye; } --- 666,679 ---- final double pix_x2, final double pix_y2, final double pix_x3, final double pix_y3) { final double xe = tosubpixx(pix_x3); final double ye = tosubpixy(pix_y3); ! curve.set(x0, y0, ! tosubpixx(pix_x1), tosubpixy(pix_y1), ! tosubpixx(pix_x2), tosubpixy(pix_y2), ! xe, ye); curveBreakIntoLinesAndAdd(x0, y0, curve, xe, ye); x0 = xe; y0 = ye; }
*** 680,690 **** public void quadTo(final double pix_x1, final double pix_y1, final double pix_x2, final double pix_y2) { final double xe = tosubpixx(pix_x2); final double ye = tosubpixy(pix_y2); ! curve.set(x0, y0, tosubpixx(pix_x1), tosubpixy(pix_y1), xe, ye); quadBreakIntoLinesAndAdd(x0, y0, curve, xe, ye); x0 = xe; y0 = ye; } --- 681,693 ---- public void quadTo(final double pix_x1, final double pix_y1, final double pix_x2, final double pix_y2) { final double xe = tosubpixx(pix_x2); final double ye = tosubpixy(pix_y2); ! curve.set(x0, y0, ! tosubpixx(pix_x1), tosubpixy(pix_y1), ! xe, ye); quadBreakIntoLinesAndAdd(x0, y0, curve, xe, ye); x0 = xe; y0 = ye; }
< prev index next >