--- old/modules/javafx.graphics/src/main/java/com/sun/prism/impl/shape/MarlinRasterizer.java 2017-11-08 22:06:41.936496814 +0100 +++ new/modules/javafx.graphics/src/main/java/com/sun/prism/impl/shape/MarlinRasterizer.java 2017-11-08 22:06:41.780493149 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -83,14 +83,9 @@ final Rectangle rclip = rdrCtx.clip; rclip.setBounds(xformBounds); - if (shape instanceof Path2D) { - renderer = MarlinPrismUtils.setupRenderer(rdrCtx, (Path2D) shape, stroke, xform, rclip, - antialiasedShape); - } - if (renderer == null) { - renderer = MarlinPrismUtils.setupRenderer(rdrCtx, shape, stroke, xform, rclip, - antialiasedShape); - } + renderer = MarlinPrismUtils.setupRenderer(rdrCtx, shape, stroke, xform, rclip, + antialiasedShape); + final int outpix_xmin = renderer.getOutpixMinX(); final int outpix_xmax = renderer.getOutpixMaxX(); final int outpix_ymin = renderer.getOutpixMinY(); @@ -111,6 +106,7 @@ } consumer.setBoundsNoClone(outpix_xmin, outpix_ymin, w, h); renderer.produceAlphas(consumer); + return consumer.getMaskData(); } finally { if (renderer != null) { @@ -119,5 +115,28 @@ // recycle the RendererContext instance MarlinRenderingEngine.returnRendererContext(rdrCtx); } + } + + static Shape createCenteredStrokedShape(Shape s, BasicStroke stroke) + { + final float lw = (stroke.getType() == BasicStroke.TYPE_CENTERED) ? + stroke.getLineWidth() : stroke.getLineWidth() * 2.0f; + + final RendererContext rdrCtx = MarlinRenderingEngine.getRendererContext(); + try { + // initialize a large copyable Path2D to avoid a lot of array growing: + final Path2D p2d = rdrCtx.getPath2D(); + + MarlinPrismUtils.strokeTo(rdrCtx, s, stroke, lw, + rdrCtx.transformerPC2D.wrapPath2D(p2d) + ); + + // Use Path2D copy constructor (trim) + return new Path2D(p2d); + + } finally { + // recycle the RendererContext instance + MarlinRenderingEngine.returnRendererContext(rdrCtx); + } } }