< prev index next >

src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java

Print this page

        

*** 42,53 **** import sun.security.action.GetPropertyAction; /** * Marlin RendererEngine implementation (derived from Pisces) */ ! public class MarlinRenderingEngine extends RenderingEngine ! implements MarlinConst { private static enum NormMode { ON_WITH_AA { @Override PathIterator getNormalizingPathIterator(final RendererContext rdrCtx, --- 42,53 ---- import sun.security.action.GetPropertyAction; /** * Marlin RendererEngine implementation (derived from Pisces) */ ! public final class MarlinRenderingEngine extends RenderingEngine ! implements MarlinConst { private static enum NormMode { ON_WITH_AA { @Override PathIterator getNormalizingPathIterator(final RendererContext rdrCtx,
*** 78,88 **** abstract PathIterator getNormalizingPathIterator(RendererContext rdrCtx, PathIterator src); } ! private static final float MIN_PEN_SIZE = 1f / NORM_SUBPIXELS; static final float UPPER_BND = Float.MAX_VALUE / 2.0f; static final float LOWER_BND = -UPPER_BND; /** --- 78,88 ---- abstract PathIterator getNormalizingPathIterator(RendererContext rdrCtx, PathIterator src); } ! private static final float MIN_PEN_SIZE = 1.0f / NORM_SUBPIXELS; static final float UPPER_BND = Float.MAX_VALUE / 2.0f; static final float LOWER_BND = -UPPER_BND; /**
*** 257,267 **** * Trigonometric equalities can then be used to get * rid of most of the sqrt terms. */ double EA = A*A + B*B; // x^2 coefficient ! double EB = 2.0*(A*C + B*D); // xy coefficient double EC = C*C + D*D; // y^2 coefficient /* * There is a lot of calculus omitted here. * --- 257,267 ---- * Trigonometric equalities can then be used to get * rid of most of the sqrt terms. */ double EA = A*A + B*B; // x^2 coefficient ! double EB = 2.0d * (A*C + B*D); // xy coefficient double EC = C*C + D*D; // y^2 coefficient /* * There is a lot of calculus omitted here. *
*** 285,295 **** * along that axis. */ double hypot = Math.sqrt(EB*EB + (EA-EC)*(EA-EC)); // sqrt omitted, compare to squared limits below. ! double widthsquared = ((EA + EC + hypot)/2.0); widthScale = (float)Math.sqrt(widthsquared); } return (lw / widthScale); --- 285,295 ---- * along that axis. */ double hypot = Math.sqrt(EB*EB + (EA-EC)*(EA-EC)); // sqrt omitted, compare to squared limits below. ! double widthsquared = ((EA + EC + hypot) / 2.0d); widthScale = (float)Math.sqrt(widthsquared); } return (lw / widthScale);
*** 330,340 **** final double b = at.getShearX(); final double c = at.getShearY(); final double d = at.getScaleY(); final double det = a * d - c * b; ! if (Math.abs(det) <= (2f * Float.MIN_VALUE)) { // this rendering engine takes one dimensional curves and turns // them into 2D shapes by giving them width. // However, if everything is to be passed through a singular // transformation, these 2D shapes will be squashed down to 1D // again so, nothing can be drawn. --- 330,340 ---- final double b = at.getShearX(); final double c = at.getShearY(); final double d = at.getScaleY(); final double det = a * d - c * b; ! if (Math.abs(det) <= (2.0f * Float.MIN_VALUE)) { // this rendering engine takes one dimensional curves and turns // them into 2D shapes by giving them width. // However, if everything is to be passed through a singular // transformation, these 2D shapes will be squashed down to 1D // again so, nothing can be drawn.
*** 342,352 **** // Every path needs an initial moveTo and a pathDone. If these // are not there this causes a SIGSEGV in libawt.so (at the time // of writing of this comment (September 16, 2010)). Actually, // I am not sure if the moveTo is necessary to avoid the SIGSEGV // but the pathDone is definitely needed. ! pc2d.moveTo(0f, 0f); pc2d.pathDone(); return; } // If the transform is a constant multiple of an orthogonal transformation --- 342,352 ---- // Every path needs an initial moveTo and a pathDone. If these // are not there this causes a SIGSEGV in libawt.so (at the time // of writing of this comment (September 16, 2010)). Actually, // I am not sure if the moveTo is necessary to avoid the SIGSEGV // but the pathDone is definitely needed. ! pc2d.moveTo(0.0f, 0.0f); pc2d.pathDone(); return; } // If the transform is a constant multiple of an orthogonal transformation
*** 359,379 **** final float scale = (float) Math.sqrt(a*a + c*c); if (dashes != null) { recycleDashes = true; dashLen = dashes.length; ! final float[] newDashes; ! if (dashLen <= INITIAL_ARRAY) { ! newDashes = rdrCtx.dasher.dashes_ref.initial; ! } else { ! if (DO_STATS) { ! rdrCtx.stats.stat_array_dasher_dasher.add(dashLen); ! } ! newDashes = rdrCtx.dasher.dashes_ref.getArray(dashLen); ! } ! System.arraycopy(dashes, 0, newDashes, 0, dashLen); ! dashes = newDashes; for (int i = 0; i < dashLen; i++) { dashes[i] *= scale; } dashphase *= scale; } --- 359,369 ---- final float scale = (float) Math.sqrt(a*a + c*c); if (dashes != null) { recycleDashes = true; dashLen = dashes.length; ! dashes = rdrCtx.dasher.copyDashArray(dashes); for (int i = 0; i < dashLen; i++) { dashes[i] *= scale; } dashphase *= scale; }
*** 443,453 **** * -> pc2d = Renderer (bounding box) */ } private static boolean nearZero(final double num) { ! return Math.abs(num) < 2.0 * Math.ulp(num); } abstract static class NormalizingPathIterator implements PathIterator { private PathIterator src; --- 433,443 ---- * -> pc2d = Renderer (bounding box) */ } private static boolean nearZero(final double num) { ! return Math.abs(num) < 2.0d * Math.ulp(num); } abstract static class NormalizingPathIterator implements PathIterator { private PathIterator src;
*** 522,533 **** movy_adjust = y_adjust; break; case PathIterator.SEG_LINETO: break; case PathIterator.SEG_QUADTO: ! coords[0] += (curx_adjust + x_adjust) / 2f; ! coords[1] += (cury_adjust + y_adjust) / 2f; break; case PathIterator.SEG_CUBICTO: coords[0] += curx_adjust; coords[1] += cury_adjust; coords[2] += x_adjust; --- 512,523 ---- movy_adjust = y_adjust; break; case PathIterator.SEG_LINETO: break; case PathIterator.SEG_QUADTO: ! coords[0] += (curx_adjust + x_adjust) / 2.0f; ! coords[1] += (cury_adjust + y_adjust) / 2.0f; break; case PathIterator.SEG_CUBICTO: coords[0] += curx_adjust; coords[1] += cury_adjust; coords[2] += x_adjust;
*** 822,835 **** // as it will be called later by MarlinTileGenerator.dispose() r = null; } } finally { if (r != null) { ! // dispose renderer: r.dispose(); - // recycle the RendererContext instance - MarlinRenderingEngine.returnRendererContext(rdrCtx); } } // Return null to cancel AA tile generation (nothing to render) return ptg; --- 812,823 ---- // as it will be called later by MarlinTileGenerator.dispose() r = null; } } finally { if (r != null) { ! // dispose renderer and recycle the RendererContext instance: r.dispose(); } } // Return null to cancel AA tile generation (nothing to render) return ptg;
*** 843,871 **** Region clip, int[] bbox) { // REMIND: Deal with large coordinates! double ldx1, ldy1, ldx2, ldy2; ! boolean innerpgram = (lw1 > 0.0 && lw2 > 0.0); if (innerpgram) { ldx1 = dx1 * lw1; ldy1 = dy1 * lw1; ldx2 = dx2 * lw2; ldy2 = dy2 * lw2; ! x -= (ldx1 + ldx2) / 2.0; ! y -= (ldy1 + ldy2) / 2.0; dx1 += ldx1; dy1 += ldy1; dx2 += ldx2; dy2 += ldy2; ! if (lw1 > 1.0 && lw2 > 1.0) { // Inner parallelogram was entirely consumed by stroke... innerpgram = false; } } else { ! ldx1 = ldy1 = ldx2 = ldy2 = 0.0; } MarlinTileGenerator ptg = null; Renderer r = null; --- 831,859 ---- Region clip, int[] bbox) { // REMIND: Deal with large coordinates! double ldx1, ldy1, ldx2, ldy2; ! boolean innerpgram = (lw1 > 0.0d && lw2 > 0.0d); if (innerpgram) { ldx1 = dx1 * lw1; ldy1 = dy1 * lw1; ldx2 = dx2 * lw2; ldy2 = dy2 * lw2; ! x -= (ldx1 + ldx2) / 2.0d; ! y -= (ldy1 + ldy2) / 2.0d; dx1 += ldx1; dy1 += ldy1; dx2 += ldx2; dy2 += ldy2; ! if (lw1 > 1.0d && lw2 > 1.0d) { // Inner parallelogram was entirely consumed by stroke... innerpgram = false; } } else { ! ldx1 = ldy1 = ldx2 = ldy2 = 0.0d; } MarlinTileGenerator ptg = null; Renderer r = null;
*** 882,895 **** r.closePath(); if (innerpgram) { x += ldx1 + ldx2; y += ldy1 + ldy2; ! dx1 -= 2.0 * ldx1; ! dy1 -= 2.0 * ldy1; ! dx2 -= 2.0 * ldx2; ! dy2 -= 2.0 * ldy2; r.moveTo((float) x, (float) y); r.lineTo((float) (x+dx1), (float) (y+dy1)); r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2)); r.lineTo((float) (x+dx2), (float) (y+dy2)); r.closePath(); --- 870,883 ---- r.closePath(); if (innerpgram) { x += ldx1 + ldx2; y += ldy1 + ldy2; ! dx1 -= 2.0d * ldx1; ! dy1 -= 2.0d * ldy1; ! dx2 -= 2.0d * ldx2; ! dy2 -= 2.0d * ldy2; r.moveTo((float) x, (float) y); r.lineTo((float) (x+dx1), (float) (y+dy1)); r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2)); r.lineTo((float) (x+dx2), (float) (y+dy2)); r.closePath();
*** 903,916 **** // as it will be called later by MarlinTileGenerator.dispose() r = null; } } finally { if (r != null) { ! // dispose renderer: r.dispose(); - // recycle the RendererContext instance - MarlinRenderingEngine.returnRendererContext(rdrCtx); } } // Return null to cancel AA tile generation (nothing to render) return ptg; --- 891,902 ---- // as it will be called later by MarlinTileGenerator.dispose() r = null; } } finally { if (r != null) { ! // dispose renderer and recycle the RendererContext instance: r.dispose(); } } // Return null to cancel AA tile generation (nothing to render) return ptg;
*** 1033,1048 **** logInfo("sun.java2d.renderer.subPixel_log2_X = " + MarlinConst.SUBPIXEL_LG_POSITIONS_X); logInfo("sun.java2d.renderer.subPixel_log2_Y = " + MarlinConst.SUBPIXEL_LG_POSITIONS_Y); - logInfo("sun.java2d.renderer.tileSize_log2 = " - + MarlinConst.TILE_SIZE_LG); - - logInfo("sun.java2d.renderer.blockSize_log2 = " - + MarlinConst.BLOCK_SIZE_LG); logInfo("sun.java2d.renderer.blockSize_log2 = " + MarlinConst.BLOCK_SIZE_LG); // RLE / blockFlags settings --- 1019,1033 ---- logInfo("sun.java2d.renderer.subPixel_log2_X = " + MarlinConst.SUBPIXEL_LG_POSITIONS_X); logInfo("sun.java2d.renderer.subPixel_log2_Y = " + MarlinConst.SUBPIXEL_LG_POSITIONS_Y); + logInfo("sun.java2d.renderer.tileSize_log2 = " + + MarlinConst.TILE_H_LG); + logInfo("sun.java2d.renderer.tileWidth_log2 = " + + MarlinConst.TILE_W_LG); logInfo("sun.java2d.renderer.blockSize_log2 = " + MarlinConst.BLOCK_SIZE_LG); // RLE / blockFlags settings
*** 1076,1087 **** + MarlinConst.LOG_CREATE_CONTEXT); logInfo("sun.java2d.renderer.logUnsafeMalloc = " + MarlinConst.LOG_UNSAFE_MALLOC); // quality settings logInfo("Renderer settings:"); - logInfo("CUB_COUNT_LG = " + Renderer.CUB_COUNT_LG); logInfo("CUB_DEC_BND = " + Renderer.CUB_DEC_BND); logInfo("CUB_INC_BND = " + Renderer.CUB_INC_BND); logInfo("QUAD_DEC_BND = " + Renderer.QUAD_DEC_BND); logInfo("INITIAL_EDGES_CAPACITY = " --- 1061,1078 ---- + MarlinConst.LOG_CREATE_CONTEXT); logInfo("sun.java2d.renderer.logUnsafeMalloc = " + MarlinConst.LOG_UNSAFE_MALLOC); // quality settings + logInfo("sun.java2d.renderer.cubic_dec_d2 = " + + MarlinProperties.getCubicDecD2()); + logInfo("sun.java2d.renderer.cubic_inc_d1 = " + + MarlinProperties.getCubicIncD1()); + logInfo("sun.java2d.renderer.quad_dec_d2 = " + + MarlinProperties.getQuadDecD2()); + logInfo("Renderer settings:"); logInfo("CUB_DEC_BND = " + Renderer.CUB_DEC_BND); logInfo("CUB_INC_BND = " + Renderer.CUB_INC_BND); logInfo("QUAD_DEC_BND = " + Renderer.QUAD_DEC_BND); logInfo("INITIAL_EDGES_CAPACITY = "
< prev index next >