< prev index next >

src/java.desktop/share/classes/sun/java2d/pipe/AAShapePipe.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2015, 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) 1997, 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
*** 141,154 **** renderTiles(sg, s, aatg, abox, ts); } public void renderTiles(SunGraphics2D sg, Shape s, ! AATileGenerator aatg, int abox[], TileState ts) { Object context = null; try { context = outpipe.startSequence(sg, s, ts.computeDevBox(abox), abox); final int tw = aatg.getTileWidth(); --- 141,162 ---- renderTiles(sg, s, aatg, abox, ts); } public void renderTiles(SunGraphics2D sg, Shape s, ! final AATileGenerator aatg, ! final int[] abox, final TileState ts) { Object context = null; try { + // defensive copy of int[] abox as local variables: + final int bx = abox[0]; + final int by = abox[1]; + final int bw = abox[2]; + final int bh = abox[3]; + + // reentrance: outpipe may also use AAShapePipe: context = outpipe.startSequence(sg, s, ts.computeDevBox(abox), abox); final int tw = aatg.getTileWidth();
*** 156,175 **** // get tile from thread local storage: final byte[] alpha = ts.getAlphaTile(tw * th); byte[] atile; ! for (int y = abox[1]; y < abox[3]; y += th) { ! int h = Math.min(th, abox[3] - y); ! for (int x = abox[0]; x < abox[2]; x += tw) { ! int w = Math.min(tw, abox[2] - x); ! int a = aatg.getTypicalAlpha(); ! if (a == 0x00 || ! outpipe.needTile(context, x, y, w, h) == false) ! { aatg.nextTile(); outpipe.skipTile(context, x, y); continue; } if (a == 0xff) { --- 164,182 ---- // get tile from thread local storage: final byte[] alpha = ts.getAlphaTile(tw * th); byte[] atile; ! for (int y = by; y < bh; y += th) { ! final int h = Math.min(th, bh - y); ! ! for (int x = bx; x < bw; x += tw) { ! final int w = Math.min(tw, bw - x); ! final int a = aatg.getTypicalAlpha(); ! if (a == 0x00 || !outpipe.needTile(context, x, y, w, h)) { aatg.nextTile(); outpipe.skipTile(context, x, y); continue; } if (a == 0xff) {
*** 178,189 **** } else { atile = alpha; aatg.getAlpha(alpha, 0, tw); } ! outpipe.renderPathTile(context, atile, 0, tw, ! x, y, w, h); } } } finally { aatg.dispose(); if (context != null) { --- 185,196 ---- } else { atile = alpha; aatg.getAlpha(alpha, 0, tw); } ! // TODO: check reentrance issue ? on byte[] alpha ? ! outpipe.renderPathTile(context, atile, 0, tw, x, y, w, h); } } } finally { aatg.dispose(); if (context != null) {
< prev index next >