< prev index next >

modules/javafx.graphics/src/main/java/com/sun/prism/impl/shape/DMarlinRasterizer.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2010, 2016, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 81,98 **** DMarlinRenderer renderer = null; try { final Rectangle rclip = rdrCtx.clip; rclip.setBounds(xformBounds); ! if (shape instanceof Path2D) { ! renderer = DMarlinPrismUtils.setupRenderer(rdrCtx, (Path2D) shape, stroke, xform, rclip, ! antialiasedShape); ! } ! if (renderer == null) { ! renderer = DMarlinPrismUtils.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(); final int outpix_ymax = renderer.getOutpixMaxY(); final int w = outpix_xmax - outpix_xmin; --- 81,93 ---- DMarlinRenderer renderer = null; try { final Rectangle rclip = rdrCtx.clip; rclip.setBounds(xformBounds); ! renderer = DMarlinPrismUtils.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(); final int outpix_ymax = renderer.getOutpixMaxY(); final int w = outpix_xmax - outpix_xmin;
*** 109,123 **** System.out.println("new alphas with length = " + csize); } } consumer.setBoundsNoClone(outpix_xmin, outpix_ymin, w, h); renderer.produceAlphas(consumer); return consumer.getMaskData(); } finally { if (renderer != null) { renderer.dispose(); } ! // recycle the RendererContext instance DMarlinRenderingEngine.returnRendererContext(rdrCtx); } } } --- 104,142 ---- System.out.println("new alphas with length = " + csize); } } consumer.setBoundsNoClone(outpix_xmin, outpix_ymin, w, h); renderer.produceAlphas(consumer); + return consumer.getMaskData(); } finally { if (renderer != null) { renderer.dispose(); } ! // recycle the DRendererContext instance ! DMarlinRenderingEngine.returnRendererContext(rdrCtx); ! } ! } ! ! static Shape createCenteredStrokedShape(Shape s, BasicStroke stroke) ! { ! final float lw = (stroke.getType() == BasicStroke.TYPE_CENTERED) ? ! stroke.getLineWidth() : stroke.getLineWidth() * 2.0f; ! ! final DRendererContext rdrCtx = DMarlinRenderingEngine.getRendererContext(); ! try { ! // initialize a large copyable Path2D to avoid a lot of array growing: ! final Path2D p2d = rdrCtx.getPath2D(); ! ! DMarlinPrismUtils.strokeTo(rdrCtx, s, stroke, lw, ! rdrCtx.transformerPC2D.wrapPath2d(p2d) ! ); ! ! // Use Path2D copy constructor (trim) ! return new Path2D(p2d); ! ! } finally { ! // recycle the DRendererContext instance DMarlinRenderingEngine.returnRendererContext(rdrCtx); } } }
< prev index next >