8159093: Fix coding conventions in Marlin renderer
Capital letters for constants and use rdrCtx.stats (field) Reviewed-by: flar, prr
This commit is contained in:
parent
b07d2cc56d
commit
3bd31d61ae
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -58,7 +58,7 @@ public final class ArrayCache implements MarlinConst {
|
||||
for (int i = 0; i < BUCKETS; i++, arraySize <<= 2) {
|
||||
ARRAY_SIZES[i] = arraySize;
|
||||
|
||||
if (doTrace) {
|
||||
if (DO_TRACE) {
|
||||
logInfo("arraySize[" + i + "]: " + arraySize);
|
||||
}
|
||||
}
|
||||
@ -71,7 +71,7 @@ public final class ArrayCache implements MarlinConst {
|
||||
for (int i = 0; i < BUCKETS; i++, arraySize <<= 1) {
|
||||
DIRTY_BYTE_ARRAY_SIZES[i] = arraySize;
|
||||
|
||||
if (doTrace) {
|
||||
if (DO_TRACE) {
|
||||
logInfo("dirty arraySize[" + i + "]: " + arraySize);
|
||||
}
|
||||
}
|
||||
@ -83,7 +83,7 @@ public final class ArrayCache implements MarlinConst {
|
||||
THRESHOLD_LARGE_ARRAY_SIZE = 8L * THRESHOLD_ARRAY_SIZE; // 16M
|
||||
THRESHOLD_HUGE_ARRAY_SIZE = 8L * THRESHOLD_LARGE_ARRAY_SIZE; // 128M
|
||||
|
||||
if (doStats || doMonitors) {
|
||||
if (DO_STATS || DO_MONITORS) {
|
||||
logInfo("ArrayCache.BUCKETS = " + BUCKETS);
|
||||
logInfo("ArrayCache.MIN_ARRAY_SIZE = " + MIN_ARRAY_SIZE);
|
||||
logInfo("ArrayCache.MAX_ARRAY_SIZE = " + MAX_ARRAY_SIZE);
|
||||
|
@ -54,7 +54,7 @@ final class ByteArrayCache implements MarlinConst {
|
||||
}
|
||||
|
||||
byte[] getArray() {
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
getOp++;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ final class ByteArrayCache implements MarlinConst {
|
||||
return array;
|
||||
}
|
||||
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
createOp++;
|
||||
}
|
||||
|
||||
@ -73,18 +73,18 @@ final class ByteArrayCache implements MarlinConst {
|
||||
|
||||
void putDirtyArray(final byte[] array, final int length) {
|
||||
if (length != arraySize) {
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
MarlinUtils.logInfo("ArrayCache: bad length = " + length);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
returnOp++;
|
||||
}
|
||||
|
||||
// NO clean-up of array data = DIRTY ARRAY
|
||||
|
||||
if (doCleanDirty) {
|
||||
if (DO_CLEAN_DIRTY) {
|
||||
// Force zero-fill dirty arrays:
|
||||
Arrays.fill(array, 0, array.length, BYTE_0);
|
||||
}
|
||||
@ -97,12 +97,12 @@ final class ByteArrayCache implements MarlinConst {
|
||||
final int fromIndex, final int toIndex)
|
||||
{
|
||||
if (length != arraySize) {
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
MarlinUtils.logInfo("ArrayCache: bad length = " + length);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
returnOp++;
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ final class ByteArrayCache implements MarlinConst {
|
||||
Arrays.fill(array, fromIndex, toIndex, value);
|
||||
}
|
||||
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
check(array, fromIndex, toIndex, value);
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ final class ByteArrayCache implements MarlinConst {
|
||||
static void check(final byte[] array, final int fromIndex,
|
||||
final int toIndex, final byte value)
|
||||
{
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
// check zero on full array:
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] != value) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
package sun.java2d.marlin;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
final class Curve {
|
||||
|
||||
float ax, ay, bx, by, cx, cy, dx, dy;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@ -41,9 +41,9 @@ import sun.awt.geom.PathConsumer2D;
|
||||
*/
|
||||
final class Dasher implements sun.awt.geom.PathConsumer2D, MarlinConst {
|
||||
|
||||
static final int recLimit = 4;
|
||||
static final int REC_LIMIT = 4;
|
||||
static final float ERR = 0.01f;
|
||||
static final float minTincrement = 1f / (1 << recLimit);
|
||||
static final float MIN_T_INC = 1f / (1 << REC_LIMIT);
|
||||
|
||||
private PathConsumer2D out;
|
||||
private float[] dash;
|
||||
@ -139,7 +139,7 @@ final class Dasher implements sun.awt.geom.PathConsumer2D, MarlinConst {
|
||||
* clean up before reusing this instance
|
||||
*/
|
||||
void dispose() {
|
||||
if (doCleanDirty) {
|
||||
if (DO_CLEAN_DIRTY) {
|
||||
// Force zero-fill dirty arrays:
|
||||
Arrays.fill(curCurvepts, 0f);
|
||||
Arrays.fill(firstSegmentsBuffer, 0f);
|
||||
@ -217,8 +217,8 @@ final class Dasher implements sun.awt.geom.PathConsumer2D, MarlinConst {
|
||||
int segIdx = firstSegidx;
|
||||
float[] buf = firstSegmentsBuffer;
|
||||
if (segIdx + len > buf.length) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_array_dasher_firstSegmentsBuffer
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_array_dasher_firstSegmentsBuffer
|
||||
.add(segIdx + len);
|
||||
}
|
||||
firstSegmentsBuffer = buf
|
||||
@ -403,8 +403,8 @@ final class Dasher implements sun.awt.geom.PathConsumer2D, MarlinConst {
|
||||
private final float[] curLeafCtrlPolyLengths = new float[3];
|
||||
|
||||
LengthIterator() {
|
||||
this.recCurveStack = new float[recLimit + 1][8];
|
||||
this.sides = new Side[recLimit];
|
||||
this.recCurveStack = new float[REC_LIMIT + 1][8];
|
||||
this.sides = new Side[REC_LIMIT];
|
||||
// if any methods are called without first initializing this object
|
||||
// on a curve, we want it to fail ASAP.
|
||||
this.nextT = Float.MAX_VALUE;
|
||||
@ -421,7 +421,7 @@ final class Dasher implements sun.awt.geom.PathConsumer2D, MarlinConst {
|
||||
void reset() {
|
||||
// keep data dirty
|
||||
// as it appears not useful to reset data:
|
||||
if (doCleanDirty) {
|
||||
if (DO_CLEAN_DIRTY) {
|
||||
final int recLimit = recCurveStack.length - 1;
|
||||
for (int i = recLimit; i >= 0; i--) {
|
||||
Arrays.fill(recCurveStack[i], 0f);
|
||||
@ -607,7 +607,7 @@ final class Dasher implements sun.awt.geom.PathConsumer2D, MarlinConst {
|
||||
if (len >= 0f) {
|
||||
lastT = nextT;
|
||||
lenAtLastT = lenAtNextT;
|
||||
nextT += (1 << (recLimit - recLevel)) * minTincrement;
|
||||
nextT += (1 << (REC_LIMIT - recLevel)) * MIN_T_INC;
|
||||
lenAtNextT += len;
|
||||
// invalidate caches
|
||||
flatLeafCoefCache[2] = -1f;
|
||||
@ -641,7 +641,7 @@ final class Dasher implements sun.awt.geom.PathConsumer2D, MarlinConst {
|
||||
final float lineLen = Helpers.linelen(curve[0], curve[1],
|
||||
curve[curveType-2],
|
||||
curve[curveType-1]);
|
||||
if ((polyLen - lineLen) < ERR || recLevel == recLimit) {
|
||||
if ((polyLen - lineLen) < ERR || recLevel == REC_LIMIT) {
|
||||
return (polyLen + lineLen) / 2f;
|
||||
}
|
||||
return -1f;
|
||||
|
@ -54,7 +54,7 @@ final class FloatArrayCache implements MarlinConst {
|
||||
}
|
||||
|
||||
float[] getArray() {
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
getOp++;
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ final class FloatArrayCache implements MarlinConst {
|
||||
return array;
|
||||
}
|
||||
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
createOp++;
|
||||
}
|
||||
|
||||
@ -74,18 +74,18 @@ final class FloatArrayCache implements MarlinConst {
|
||||
|
||||
void putDirtyArray(final float[] array, final int length) {
|
||||
if (length != arraySize) {
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
MarlinUtils.logInfo("ArrayCache: bad length = " + length);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
returnOp++;
|
||||
}
|
||||
|
||||
// NO clean-up of array data = DIRTY ARRAY
|
||||
|
||||
if (doCleanDirty) {
|
||||
if (DO_CLEAN_DIRTY) {
|
||||
// Force zero-fill dirty arrays:
|
||||
Arrays.fill(array, 0, array.length, 0f);
|
||||
}
|
||||
@ -98,12 +98,12 @@ final class FloatArrayCache implements MarlinConst {
|
||||
final int fromIndex, final int toIndex)
|
||||
{
|
||||
if (length != arraySize) {
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
MarlinUtils.logInfo("ArrayCache: bad length = " + length);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
returnOp++;
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ final class FloatArrayCache implements MarlinConst {
|
||||
Arrays.fill(array, fromIndex, toIndex, value);
|
||||
}
|
||||
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
check(array, fromIndex, toIndex, value);
|
||||
}
|
||||
}
|
||||
@ -134,7 +134,7 @@ final class FloatArrayCache implements MarlinConst {
|
||||
static void check(final float[] array, final int fromIndex,
|
||||
final int toIndex, final float value)
|
||||
{
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
// check zero on full array:
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] != value) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@ -248,9 +248,9 @@ final class Helpers implements MarlinConst {
|
||||
* the 6 right coordinates
|
||||
* @since 1.7
|
||||
*/
|
||||
static void subdivideCubic(float src[], int srcoff,
|
||||
float left[], int leftoff,
|
||||
float right[], int rightoff)
|
||||
static void subdivideCubic(float[] src, int srcoff,
|
||||
float[] left, int leftoff,
|
||||
float[] right, int rightoff)
|
||||
{
|
||||
float x1 = src[srcoff + 0];
|
||||
float y1 = src[srcoff + 1];
|
||||
@ -299,9 +299,9 @@ final class Helpers implements MarlinConst {
|
||||
}
|
||||
|
||||
|
||||
static void subdivideCubicAt(float t, float src[], int srcoff,
|
||||
float left[], int leftoff,
|
||||
float right[], int rightoff)
|
||||
static void subdivideCubicAt(float t, float[] src, int srcoff,
|
||||
float[] left, int leftoff,
|
||||
float[] right, int rightoff)
|
||||
{
|
||||
float x1 = src[srcoff + 0];
|
||||
float y1 = src[srcoff + 1];
|
||||
@ -349,9 +349,9 @@ final class Helpers implements MarlinConst {
|
||||
}
|
||||
}
|
||||
|
||||
static void subdivideQuad(float src[], int srcoff,
|
||||
float left[], int leftoff,
|
||||
float right[], int rightoff)
|
||||
static void subdivideQuad(float[] src, int srcoff,
|
||||
float[] left, int leftoff,
|
||||
float[] right, int rightoff)
|
||||
{
|
||||
float x1 = src[srcoff + 0];
|
||||
float y1 = src[srcoff + 1];
|
||||
@ -387,9 +387,9 @@ final class Helpers implements MarlinConst {
|
||||
}
|
||||
}
|
||||
|
||||
static void subdivideQuadAt(float t, float src[], int srcoff,
|
||||
float left[], int leftoff,
|
||||
float right[], int rightoff)
|
||||
static void subdivideQuadAt(float t, float[] src, int srcoff,
|
||||
float[] left, int leftoff,
|
||||
float[] right, int rightoff)
|
||||
{
|
||||
float x1 = src[srcoff + 0];
|
||||
float y1 = src[srcoff + 1];
|
||||
@ -425,9 +425,9 @@ final class Helpers implements MarlinConst {
|
||||
}
|
||||
}
|
||||
|
||||
static void subdivideAt(float t, float src[], int srcoff,
|
||||
float left[], int leftoff,
|
||||
float right[], int rightoff, int size)
|
||||
static void subdivideAt(float t, float[] src, int srcoff,
|
||||
float[] left, int leftoff,
|
||||
float[] right, int rightoff, int size)
|
||||
{
|
||||
switch(size) {
|
||||
case 8:
|
||||
|
@ -54,7 +54,7 @@ final class IntArrayCache implements MarlinConst {
|
||||
}
|
||||
|
||||
int[] getArray() {
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
getOp++;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ final class IntArrayCache implements MarlinConst {
|
||||
return array;
|
||||
}
|
||||
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
createOp++;
|
||||
}
|
||||
|
||||
@ -73,18 +73,18 @@ final class IntArrayCache implements MarlinConst {
|
||||
|
||||
void putDirtyArray(final int[] array, final int length) {
|
||||
if (length != arraySize) {
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
MarlinUtils.logInfo("ArrayCache: bad length = " + length);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
returnOp++;
|
||||
}
|
||||
|
||||
// NO clean-up of array data = DIRTY ARRAY
|
||||
|
||||
if (doCleanDirty) {
|
||||
if (DO_CLEAN_DIRTY) {
|
||||
// Force zero-fill dirty arrays:
|
||||
Arrays.fill(array, 0, array.length, 0);
|
||||
}
|
||||
@ -97,12 +97,12 @@ final class IntArrayCache implements MarlinConst {
|
||||
final int fromIndex, final int toIndex)
|
||||
{
|
||||
if (length != arraySize) {
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
MarlinUtils.logInfo("ArrayCache: bad length = " + length);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
returnOp++;
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ final class IntArrayCache implements MarlinConst {
|
||||
Arrays.fill(array, fromIndex, toIndex, value);
|
||||
}
|
||||
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
check(array, fromIndex, toIndex, value);
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ final class IntArrayCache implements MarlinConst {
|
||||
static void check(final int[] array, final int fromIndex,
|
||||
final int toIndex, final int value)
|
||||
{
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
// check zero on full array:
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] != value) {
|
||||
|
@ -60,7 +60,7 @@ public final class MarlinCache implements MarlinConst {
|
||||
ALPHA_MAP_UNSAFE = new OffHeapArray(_ALPHA_MAP, _ALPHA_MAP.length); // 1K
|
||||
ALPHA_MAP =_ALPHA_MAP;
|
||||
|
||||
final Unsafe _unsafe = OffHeapArray.unsafe;
|
||||
final Unsafe _unsafe = OffHeapArray.UNSAFE;
|
||||
final long addr = ALPHA_MAP_UNSAFE.address;
|
||||
|
||||
for (int i = 0; i < _ALPHA_MAP.length; i++) {
|
||||
@ -157,7 +157,7 @@ public final class MarlinCache implements MarlinConst {
|
||||
|| (width * heightSubPixel) >
|
||||
((edgeSumDeltaY - heightSubPixel) << BLOCK_SIZE_LG);
|
||||
|
||||
if (doTrace && !useRLE) {
|
||||
if (DO_TRACE && !useRLE) {
|
||||
final float meanCrossings
|
||||
= ((float) edgeSumDeltaY) / heightSubPixel;
|
||||
final float meanDist = width / (meanCrossings - 1);
|
||||
@ -180,8 +180,8 @@ public final class MarlinCache implements MarlinConst {
|
||||
final int nxTiles = (width + TILE_SIZE) >> TILE_SIZE_LG;
|
||||
|
||||
if (nxTiles > INITIAL_ARRAY) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_array_marlincache_touchedTile
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_array_marlincache_touchedTile
|
||||
.add(nxTiles);
|
||||
}
|
||||
touchedTile = rdrCtx.getIntArray(nxTiles);
|
||||
@ -206,7 +206,7 @@ public final class MarlinCache implements MarlinConst {
|
||||
// note: may throw OOME:
|
||||
rowAAChunk.resize(INITIAL_CHUNK_ARRAY);
|
||||
}
|
||||
if (doCleanDirty) {
|
||||
if (DO_CLEAN_DIRTY) {
|
||||
// Force zero-fill dirty arrays:
|
||||
rowAAChunk.fill(BYTE_0);
|
||||
}
|
||||
@ -217,15 +217,15 @@ public final class MarlinCache implements MarlinConst {
|
||||
bboxY0 = pminY;
|
||||
|
||||
// reset current pos
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_cache_rowAAChunk.add(rowAAChunkPos);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_cache_rowAAChunk.add(rowAAChunkPos);
|
||||
}
|
||||
rowAAChunkPos = 0L;
|
||||
|
||||
// Reset touchedTile:
|
||||
if (tileMin != Integer.MAX_VALUE) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_cache_tiles.add(tileMax - tileMin);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_cache_tiles.add(tileMax - tileMin);
|
||||
}
|
||||
// clean only dirty touchedTile:
|
||||
if (tileMax == 1) {
|
||||
@ -238,7 +238,7 @@ public final class MarlinCache implements MarlinConst {
|
||||
tileMax = Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
if (doCleanDirty) {
|
||||
if (DO_CLEAN_DIRTY) {
|
||||
// Force zero-fill dirty arrays:
|
||||
rowAAChunk.fill(BYTE_0);
|
||||
}
|
||||
@ -267,14 +267,14 @@ public final class MarlinCache implements MarlinConst {
|
||||
void copyAARowNoRLE(final int[] alphaRow, final int y,
|
||||
final int px0, final int px1)
|
||||
{
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_rdr_copyAARow.start();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_rdr_copyAARow.start();
|
||||
}
|
||||
|
||||
// skip useless pixels above boundary
|
||||
final int px_bbox1 = FloatMath.min(px1, bboxX1);
|
||||
|
||||
if (doLogBounds) {
|
||||
if (DO_LOG_BOUNDS) {
|
||||
MarlinUtils.logInfo("row = [" + px0 + " ... " + px_bbox1
|
||||
+ " (" + px1 + ") [ for y=" + y);
|
||||
}
|
||||
@ -305,8 +305,8 @@ public final class MarlinCache implements MarlinConst {
|
||||
if (_rowAAChunk.length < needSize) {
|
||||
expandRowAAChunk(needSize);
|
||||
}
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_cache_rowAA.add(px_bbox1 - px0);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_cache_rowAA.add(px_bbox1 - px0);
|
||||
}
|
||||
|
||||
// rowAA contains only alpha values for range[x0; x1[
|
||||
@ -316,7 +316,7 @@ public final class MarlinCache implements MarlinConst {
|
||||
final int from = px0 - bboxX0; // first pixel inclusive
|
||||
final int to = px_bbox1 - bboxX0; // last pixel exclusive
|
||||
|
||||
final Unsafe _unsafe = OffHeapArray.unsafe;
|
||||
final Unsafe _unsafe = OffHeapArray.UNSAFE;
|
||||
final long SIZE_BYTE = 1L;
|
||||
final long addr_alpha = ALPHA_MAP_UNSAFE.address;
|
||||
long addr_off = _rowAAChunk.address + pos;
|
||||
@ -361,23 +361,23 @@ public final class MarlinCache implements MarlinConst {
|
||||
tileMax = tx;
|
||||
}
|
||||
|
||||
if (doLogBounds) {
|
||||
if (DO_LOG_BOUNDS) {
|
||||
MarlinUtils.logInfo("clear = [" + from + " ... " + to + "[");
|
||||
}
|
||||
|
||||
// Clear alpha row for reuse:
|
||||
IntArrayCache.fill(alphaRow, from, px1 - bboxX0, 0);
|
||||
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_rdr_copyAARow.stop();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_rdr_copyAARow.stop();
|
||||
}
|
||||
}
|
||||
|
||||
void copyAARowRLE_WithBlockFlags(final int[] blkFlags, final int[] alphaRow,
|
||||
final int y, final int px0, final int px1)
|
||||
{
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_rdr_copyAARow.start();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_rdr_copyAARow.start();
|
||||
}
|
||||
|
||||
// Copy rowAA data into the piscesCache if one is present
|
||||
@ -391,7 +391,7 @@ public final class MarlinCache implements MarlinConst {
|
||||
final int px_bbox1 = FloatMath.min(px1, bboxX1);
|
||||
final int to = px_bbox1 - _bboxX0; // last pixel exclusive
|
||||
|
||||
if (doLogBounds) {
|
||||
if (DO_LOG_BOUNDS) {
|
||||
MarlinUtils.logInfo("row = [" + px0 + " ... " + px_bbox1
|
||||
+ " (" + px1 + ") [ for y=" + y);
|
||||
}
|
||||
@ -410,7 +410,7 @@ public final class MarlinCache implements MarlinConst {
|
||||
expandRowAAChunk(needSize);
|
||||
}
|
||||
|
||||
final Unsafe _unsafe = OffHeapArray.unsafe;
|
||||
final Unsafe _unsafe = OffHeapArray.UNSAFE;
|
||||
final long SIZE_INT = 4L;
|
||||
final long addr_alpha = ALPHA_MAP_UNSAFE.address;
|
||||
long addr_off = _rowAAChunk.address + initialPos;
|
||||
@ -465,7 +465,7 @@ public final class MarlinCache implements MarlinConst {
|
||||
// note: it should check X is smaller than 23bits (overflow)!
|
||||
|
||||
// check address alignment to 4 bytes:
|
||||
if (doCheckUnsafe) {
|
||||
if (DO_CHECK_UNSAFE) {
|
||||
if ((addr_off & 3) != 0) {
|
||||
MarlinUtils.logInfo("Misaligned Unsafe address: " + addr_off);
|
||||
}
|
||||
@ -490,8 +490,8 @@ public final class MarlinCache implements MarlinConst {
|
||||
}
|
||||
addr_off += SIZE_INT;
|
||||
|
||||
if (doStats) {
|
||||
RendererContext.stats.hist_tile_generator_encoding_runLen
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.hist_tile_generator_encoding_runLen
|
||||
.add(runLen);
|
||||
}
|
||||
cx0 = cx;
|
||||
@ -513,7 +513,7 @@ public final class MarlinCache implements MarlinConst {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (doStats) {
|
||||
} else if (DO_STATS) {
|
||||
skip++;
|
||||
}
|
||||
}
|
||||
@ -528,7 +528,7 @@ public final class MarlinCache implements MarlinConst {
|
||||
// note: it should check X is smaller than 23bits (overflow)!
|
||||
|
||||
// check address alignment to 4 bytes:
|
||||
if (doCheckUnsafe) {
|
||||
if (DO_CHECK_UNSAFE) {
|
||||
if ((addr_off & 3) != 0) {
|
||||
MarlinUtils.logInfo("Misaligned Unsafe address: " + addr_off);
|
||||
}
|
||||
@ -553,8 +553,8 @@ public final class MarlinCache implements MarlinConst {
|
||||
}
|
||||
addr_off += SIZE_INT;
|
||||
|
||||
if (doStats) {
|
||||
RendererContext.stats.hist_tile_generator_encoding_runLen
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.hist_tile_generator_encoding_runLen
|
||||
.add(runLen);
|
||||
}
|
||||
|
||||
@ -566,9 +566,9 @@ public final class MarlinCache implements MarlinConst {
|
||||
// update current position:
|
||||
rowAAChunkPos = len;
|
||||
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_cache_rowAA.add(rowAALen[row]);
|
||||
RendererContext.stats.hist_tile_generator_encoding_ratio.add(
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_cache_rowAA.add(rowAALen[row]);
|
||||
rdrCtx.stats.hist_tile_generator_encoding_ratio.add(
|
||||
(100 * skip) / (blkE - blkW)
|
||||
);
|
||||
}
|
||||
@ -589,13 +589,13 @@ public final class MarlinCache implements MarlinConst {
|
||||
alphaRow[to ] = 0;
|
||||
alphaRow[to + 1] = 0;
|
||||
}
|
||||
if (doChecks) {
|
||||
if (DO_CHECKS) {
|
||||
IntArrayCache.check(blkFlags, blkW, blkE, 0);
|
||||
IntArrayCache.check(alphaRow, from, px1 - bboxX0, 0);
|
||||
}
|
||||
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_rdr_copyAARow.stop();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_rdr_copyAARow.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -611,8 +611,8 @@ public final class MarlinCache implements MarlinConst {
|
||||
}
|
||||
|
||||
private void expandRowAAChunk(final long needSize) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_array_marlincache_rowAAChunk
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_array_marlincache_rowAAChunk
|
||||
.add(needSize);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -30,54 +30,55 @@ package sun.java2d.marlin;
|
||||
*/
|
||||
interface MarlinConst {
|
||||
// enable Logs (logger or stdout)
|
||||
static final boolean enableLogs = MarlinProperties.isLoggingEnabled();
|
||||
static final boolean ENABLE_LOGS = MarlinProperties.isLoggingEnabled();
|
||||
// use Logger instead of stdout
|
||||
static final boolean useLogger = enableLogs && MarlinProperties.isUseLogger();
|
||||
static final boolean USE_LOGGER = ENABLE_LOGS && MarlinProperties.isUseLogger();
|
||||
|
||||
// log new RendererContext
|
||||
static final boolean logCreateContext = enableLogs
|
||||
static final boolean LOG_CREATE_CONTEXT = ENABLE_LOGS
|
||||
&& MarlinProperties.isLogCreateContext();
|
||||
// log misc.Unsafe alloc/realloc/free
|
||||
static final boolean logUnsafeMalloc = enableLogs
|
||||
static final boolean LOG_UNSAFE_MALLOC = ENABLE_LOGS
|
||||
&& MarlinProperties.isLogUnsafeMalloc();
|
||||
// do check unsafe alignment:
|
||||
static final boolean doCheckUnsafe = false;
|
||||
static final boolean DO_CHECK_UNSAFE = false;
|
||||
|
||||
// do statistics
|
||||
static final boolean doStats = enableLogs && MarlinProperties.isDoStats();
|
||||
static final boolean DO_STATS = ENABLE_LOGS && MarlinProperties.isDoStats();
|
||||
// do monitors
|
||||
// disabled to reduce byte-code size a bit...
|
||||
static final boolean doMonitors = false;
|
||||
// static final boolean doMonitors = enableLogs && MarlinProperties.isDoMonitors();
|
||||
static final boolean DO_MONITORS = false;
|
||||
// static final boolean DO_MONITORS = ENABLE_LOGS && MarlinProperties.isDoMonitors();
|
||||
// do checks
|
||||
static final boolean doChecks = enableLogs && MarlinProperties.isDoChecks();
|
||||
static final boolean DO_CHECKS = ENABLE_LOGS && MarlinProperties.isDoChecks();
|
||||
|
||||
// do AA range checks: disable when algorithm / code is stable
|
||||
static final boolean DO_AA_RANGE_CHECK = false;
|
||||
|
||||
// enable logs
|
||||
static final boolean doLogWidenArray = enableLogs && false;
|
||||
static final boolean DO_LOG_WIDEN_ARRAY = ENABLE_LOGS && false;
|
||||
// enable oversize logs
|
||||
static final boolean doLogOverSize = enableLogs && false;
|
||||
static final boolean DO_LOG_OVERSIZE = ENABLE_LOGS && false;
|
||||
// enable traces
|
||||
static final boolean doTrace = enableLogs && false;
|
||||
static final boolean DO_TRACE = ENABLE_LOGS && false;
|
||||
|
||||
// do flush monitors
|
||||
static final boolean doFlushMonitors = true;
|
||||
static final boolean DO_FLUSH_MONITORS = true;
|
||||
// use one polling thread to dump statistics/monitors
|
||||
static final boolean useDumpThread = false;
|
||||
static final boolean USE_DUMP_THREAD = false;
|
||||
// thread dump interval (ms)
|
||||
static final long statDump = 5000L;
|
||||
static final long DUMP_INTERVAL = 5000L;
|
||||
|
||||
// do clean dirty array
|
||||
static final boolean doCleanDirty = false;
|
||||
static final boolean DO_CLEAN_DIRTY = false;
|
||||
|
||||
// flag to use line simplifier
|
||||
static final boolean useSimplifier = MarlinProperties.isUseSimplifier();
|
||||
static final boolean USE_SIMPLIFIER = MarlinProperties.isUseSimplifier();
|
||||
|
||||
// flag to enable logs related bounds checks
|
||||
static final boolean doLogBounds = enableLogs && false;
|
||||
static final boolean DO_LOG_BOUNDS = ENABLE_LOGS && false;
|
||||
|
||||
// Initial Array sizing (initial context capacity) ~ 512K
|
||||
// Initial Array sizing (initial context capacity) ~ 350K
|
||||
|
||||
// 2048 pixel (width x height) for initial capacity
|
||||
static final int INITIAL_PIXEL_DIM
|
||||
@ -88,8 +89,6 @@ interface MarlinConst {
|
||||
static final int INITIAL_SMALL_ARRAY = 1024;
|
||||
static final int INITIAL_MEDIUM_ARRAY = 4096;
|
||||
static final int INITIAL_LARGE_ARRAY = 8192;
|
||||
static final int INITIAL_ARRAY_16K = 16384;
|
||||
static final int INITIAL_ARRAY_32K = 32768;
|
||||
// alpha row dimension
|
||||
static final int INITIAL_AA_ARRAY = INITIAL_PIXEL_DIM;
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
int caps,
|
||||
int join,
|
||||
float miterlimit,
|
||||
float dashes[],
|
||||
float[] dashes,
|
||||
float dashphase)
|
||||
{
|
||||
final RendererContext rdrCtx = getRendererContext();
|
||||
@ -278,7 +278,7 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
int caps,
|
||||
int join,
|
||||
float miterlimit,
|
||||
float dashes[],
|
||||
float[] dashes,
|
||||
float dashphase,
|
||||
PathConsumer2D pc2d)
|
||||
{
|
||||
@ -340,8 +340,8 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
if (dashLen <= INITIAL_ARRAY) {
|
||||
newDashes = rdrCtx.dasher.dashes_initial;
|
||||
} else {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_array_dasher_dasher
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_array_dasher_dasher
|
||||
.add(dashLen);
|
||||
}
|
||||
newDashes = rdrCtx.getDirtyFloatArray(dashLen);
|
||||
@ -380,7 +380,7 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
at = null;
|
||||
}
|
||||
|
||||
if (useSimplifier) {
|
||||
if (USE_SIMPLIFIER) {
|
||||
// Use simplifier after stroker before Renderer
|
||||
// to remove collinear segments (notably due to cap square)
|
||||
pc2d = rdrCtx.simplifier.init(pc2d);
|
||||
@ -474,9 +474,6 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
|
||||
@Override
|
||||
public final int currentSegment(final float[] coords) {
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_npi_currentSegment.start();
|
||||
}
|
||||
int lastCoord;
|
||||
final int type = src.currentSegment(coords);
|
||||
|
||||
@ -495,17 +492,11 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
// we don't want to deal with this case later. We just exit now
|
||||
curx_adjust = movx_adjust;
|
||||
cury_adjust = movy_adjust;
|
||||
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_npi_currentSegment.stop();
|
||||
}
|
||||
return type;
|
||||
default:
|
||||
throw new InternalError("Unrecognized curve type");
|
||||
}
|
||||
|
||||
// TODO: handle NaN, Inf and overflow
|
||||
|
||||
// normalize endpoint
|
||||
float coord, x_adjust, y_adjust;
|
||||
|
||||
@ -543,10 +534,6 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
}
|
||||
curx_adjust = x_adjust;
|
||||
cury_adjust = y_adjust;
|
||||
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_npi_currentSegment.stop();
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@ -790,7 +777,7 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
BasicStroke bs,
|
||||
boolean thin,
|
||||
boolean normalize,
|
||||
int bbox[])
|
||||
int[] bbox)
|
||||
{
|
||||
MarlinTileGenerator ptg = null;
|
||||
Renderer r = null;
|
||||
@ -808,6 +795,7 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
final PathIterator pi = getNormalizingPathIterator(rdrCtx, norm,
|
||||
s.getPathIterator(_at));
|
||||
|
||||
// note: Winding rule may be EvenOdd ONLY for fill operations !
|
||||
r = rdrCtx.renderer.init(clip.getLoX(), clip.getLoY(),
|
||||
clip.getWidth(), clip.getHeight(),
|
||||
pi.getWindingRule());
|
||||
@ -848,7 +836,7 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
double dx2, double dy2,
|
||||
double lw1, double lw2,
|
||||
Region clip,
|
||||
int bbox[])
|
||||
int[] bbox)
|
||||
{
|
||||
// REMIND: Deal with large coordinates!
|
||||
double ldx1, ldy1, ldx2, ldy2;
|
||||
@ -949,17 +937,17 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
|
||||
// --- RendererContext handling ---
|
||||
// use ThreadLocal or ConcurrentLinkedQueue to get one RendererContext
|
||||
private static final boolean useThreadLocal;
|
||||
private static final boolean USE_THREAD_LOCAL;
|
||||
|
||||
// reference type stored in either TL or CLQ
|
||||
static final int REF_TYPE;
|
||||
|
||||
// Per-thread RendererContext
|
||||
private static final ReentrantContextProvider<RendererContext> rdrCtxProvider;
|
||||
private static final ReentrantContextProvider<RendererContext> RDR_CTX_PROVIDER;
|
||||
|
||||
// Static initializer to use TL or CLQ mode
|
||||
static {
|
||||
useThreadLocal = MarlinProperties.isUseThreadLocal();
|
||||
USE_THREAD_LOCAL = MarlinProperties.isUseThreadLocal();
|
||||
|
||||
// Soft reference by default:
|
||||
final String refType = AccessController.doPrivileged(
|
||||
@ -978,8 +966,8 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
break;
|
||||
}
|
||||
|
||||
if (useThreadLocal) {
|
||||
rdrCtxProvider = new ReentrantContextProviderTL<RendererContext>(REF_TYPE)
|
||||
if (USE_THREAD_LOCAL) {
|
||||
RDR_CTX_PROVIDER = new ReentrantContextProviderTL<RendererContext>(REF_TYPE)
|
||||
{
|
||||
@Override
|
||||
protected RendererContext newContext() {
|
||||
@ -987,7 +975,7 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
}
|
||||
};
|
||||
} else {
|
||||
rdrCtxProvider = new ReentrantContextProviderCLQ<RendererContext>(REF_TYPE)
|
||||
RDR_CTX_PROVIDER = new ReentrantContextProviderCLQ<RendererContext>(REF_TYPE)
|
||||
{
|
||||
@Override
|
||||
protected RendererContext newContext() {
|
||||
@ -997,14 +985,14 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean settingsLogged = !enableLogs;
|
||||
private static boolean SETTINGS_LOGGED = !ENABLE_LOGS;
|
||||
|
||||
private static void logSettings(final String reClass) {
|
||||
// log information at startup
|
||||
if (settingsLogged) {
|
||||
if (SETTINGS_LOGGED) {
|
||||
return;
|
||||
}
|
||||
settingsLogged = true;
|
||||
SETTINGS_LOGGED = true;
|
||||
|
||||
String refType;
|
||||
switch (REF_TYPE) {
|
||||
@ -1029,7 +1017,7 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
logInfo("sun.java2d.renderer = "
|
||||
+ reClass);
|
||||
logInfo("sun.java2d.renderer.useThreadLocal = "
|
||||
+ useThreadLocal);
|
||||
+ USE_THREAD_LOCAL);
|
||||
logInfo("sun.java2d.renderer.useRef = "
|
||||
+ refType);
|
||||
|
||||
@ -1063,23 +1051,23 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
|
||||
// optimisation parameters
|
||||
logInfo("sun.java2d.renderer.useSimplifier = "
|
||||
+ MarlinConst.useSimplifier);
|
||||
+ MarlinConst.USE_SIMPLIFIER);
|
||||
|
||||
// debugging parameters
|
||||
logInfo("sun.java2d.renderer.doStats = "
|
||||
+ MarlinConst.doStats);
|
||||
+ MarlinConst.DO_STATS);
|
||||
logInfo("sun.java2d.renderer.doMonitors = "
|
||||
+ MarlinConst.doMonitors);
|
||||
+ MarlinConst.DO_MONITORS);
|
||||
logInfo("sun.java2d.renderer.doChecks = "
|
||||
+ MarlinConst.doChecks);
|
||||
+ MarlinConst.DO_CHECKS);
|
||||
|
||||
// logging parameters
|
||||
logInfo("sun.java2d.renderer.useLogger = "
|
||||
+ MarlinConst.useLogger);
|
||||
+ MarlinConst.USE_LOGGER);
|
||||
logInfo("sun.java2d.renderer.logCreateContext = "
|
||||
+ MarlinConst.logCreateContext);
|
||||
+ MarlinConst.LOG_CREATE_CONTEXT);
|
||||
logInfo("sun.java2d.renderer.logUnsafeMalloc = "
|
||||
+ MarlinConst.logUnsafeMalloc);
|
||||
+ MarlinConst.LOG_UNSAFE_MALLOC);
|
||||
|
||||
// quality settings
|
||||
logInfo("Renderer settings:");
|
||||
@ -1098,9 +1086,9 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
static RendererContext getRendererContext() {
|
||||
final RendererContext rdrCtx = rdrCtxProvider.acquire();
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_pre_getAATileGenerator.start();
|
||||
final RendererContext rdrCtx = RDR_CTX_PROVIDER.acquire();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_pre_getAATileGenerator.start();
|
||||
}
|
||||
return rdrCtx;
|
||||
}
|
||||
@ -1112,9 +1100,9 @@ public class MarlinRenderingEngine extends RenderingEngine
|
||||
static void returnRendererContext(final RendererContext rdrCtx) {
|
||||
rdrCtx.dispose();
|
||||
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_pre_getAATileGenerator.stop();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_pre_getAATileGenerator.stop();
|
||||
}
|
||||
rdrCtxProvider.release(rdrCtx);
|
||||
RDR_CTX_PROVIDER.release(rdrCtx);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@ -37,9 +37,13 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
private final MarlinCache cache;
|
||||
private int x, y;
|
||||
|
||||
// per-thread renderer context
|
||||
final RendererContext rdrCtx;
|
||||
|
||||
MarlinTileGenerator(Renderer r) {
|
||||
this.rdr = r;
|
||||
this.cache = r.cache;
|
||||
this.rdrCtx = r.rdrCtx;
|
||||
}
|
||||
|
||||
MarlinTileGenerator init() {
|
||||
@ -55,19 +59,19 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (doMonitors) {
|
||||
if (DO_MONITORS) {
|
||||
// called from AAShapePipe.renderTiles() (render tiles end):
|
||||
RendererContext.stats.mon_pipe_renderTiles.stop();
|
||||
rdrCtx.stats.mon_pipe_renderTiles.stop();
|
||||
}
|
||||
// dispose cache:
|
||||
cache.dispose();
|
||||
// dispose renderer:
|
||||
rdr.dispose();
|
||||
// recycle the RendererContext instance
|
||||
MarlinRenderingEngine.returnRendererContext(rdr.rdrCtx);
|
||||
MarlinRenderingEngine.returnRendererContext(rdrCtx);
|
||||
}
|
||||
|
||||
void getBbox(int bbox[]) {
|
||||
void getBbox(int[] bbox) {
|
||||
bbox[0] = cache.bboxX0;
|
||||
bbox[1] = cache.bboxY0;
|
||||
bbox[2] = cache.bboxX1;
|
||||
@ -80,9 +84,9 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
*/
|
||||
@Override
|
||||
public int getTileWidth() {
|
||||
if (doMonitors) {
|
||||
if (DO_MONITORS) {
|
||||
// called from AAShapePipe.renderTiles() (render tiles start):
|
||||
RendererContext.stats.mon_pipe_renderTiles.start();
|
||||
rdrCtx.stats.mon_pipe_renderTiles.start();
|
||||
}
|
||||
return TILE_SIZE;
|
||||
}
|
||||
@ -126,8 +130,8 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
// values anyway.
|
||||
final int alpha = (al == 0x00 ? 0x00
|
||||
: (al == MAX_TILE_ALPHA_SUM ? 0xff : 0x80));
|
||||
if (doStats) {
|
||||
RendererContext.stats.hist_tile_generator_alpha.add(alpha);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.hist_tile_generator_alpha.add(alpha);
|
||||
}
|
||||
return alpha;
|
||||
}
|
||||
@ -157,7 +161,7 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
* once per tile, but not both.
|
||||
*/
|
||||
@Override
|
||||
public void getAlpha(final byte tile[], final int offset,
|
||||
public void getAlpha(final byte[] tile, final int offset,
|
||||
final int rowstride)
|
||||
{
|
||||
if (cache.useRLE) {
|
||||
@ -172,11 +176,11 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
* Either this method, or the nextTile() method should be called
|
||||
* once per tile, but not both.
|
||||
*/
|
||||
private void getAlphaNoRLE(final byte tile[], final int offset,
|
||||
private void getAlphaNoRLE(final byte[] tile, final int offset,
|
||||
final int rowstride)
|
||||
{
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_ptg_getAlpha.start();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_ptg_getAlpha.start();
|
||||
}
|
||||
|
||||
// local vars for performance:
|
||||
@ -192,12 +196,12 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
final int y0 = 0;
|
||||
final int y1 = FloatMath.min(this.y + TILE_SIZE, _cache.bboxY1) - this.y;
|
||||
|
||||
if (doLogBounds) {
|
||||
if (DO_LOG_BOUNDS) {
|
||||
MarlinUtils.logInfo("getAlpha = [" + x0 + " ... " + x1
|
||||
+ "[ [" + y0 + " ... " + y1 + "[");
|
||||
}
|
||||
|
||||
final Unsafe _unsafe = OffHeapArray.unsafe;
|
||||
final Unsafe _unsafe = OffHeapArray.UNSAFE;
|
||||
final long SIZE = 1L;
|
||||
final long addr_rowAA = _cache.rowAAChunk.address;
|
||||
long addr;
|
||||
@ -252,7 +256,7 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
cx++;
|
||||
}
|
||||
|
||||
if (doTrace) {
|
||||
if (DO_TRACE) {
|
||||
for (int i = idx - (x1 - x0); i < idx; i++) {
|
||||
System.out.print(hex(tile[i], 2));
|
||||
}
|
||||
@ -264,8 +268,8 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
|
||||
nextTile();
|
||||
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_ptg_getAlpha.stop();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_ptg_getAlpha.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,11 +278,11 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
* Either this method, or the nextTile() method should be called
|
||||
* once per tile, but not both.
|
||||
*/
|
||||
private void getAlphaRLE(final byte tile[], final int offset,
|
||||
private void getAlphaRLE(final byte[] tile, final int offset,
|
||||
final int rowstride)
|
||||
{
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_ptg_getAlpha.start();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_ptg_getAlpha.start();
|
||||
}
|
||||
|
||||
// Decode run-length encoded alpha mask data
|
||||
@ -302,12 +306,12 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
final int y0 = 0;
|
||||
final int y1 = FloatMath.min(this.y + TILE_SIZE, _cache.bboxY1) - this.y;
|
||||
|
||||
if (doLogBounds) {
|
||||
if (DO_LOG_BOUNDS) {
|
||||
MarlinUtils.logInfo("getAlpha = [" + x0 + " ... " + x1
|
||||
+ "[ [" + y0 + " ... " + y1 + "[");
|
||||
}
|
||||
|
||||
final Unsafe _unsafe = OffHeapArray.unsafe;
|
||||
final Unsafe _unsafe = OffHeapArray.UNSAFE;
|
||||
final long SIZE_BYTE = 1L;
|
||||
final long SIZE_INT = 4L;
|
||||
final long addr_rowAA = _cache.rowAAChunk.address;
|
||||
@ -438,7 +442,7 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
cx++;
|
||||
}
|
||||
|
||||
if (doTrace) {
|
||||
if (DO_TRACE) {
|
||||
for (int i = idx - (x1 - x0); i < idx; i++) {
|
||||
System.out.print(hex(tile[i], 2));
|
||||
}
|
||||
@ -450,8 +454,8 @@ final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
|
||||
|
||||
nextTile();
|
||||
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_ptg_getAlpha.stop();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_ptg_getAlpha.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -28,13 +28,13 @@ package sun.java2d.marlin;
|
||||
|
||||
public final class MarlinUtils {
|
||||
// Marlin logger
|
||||
private static final sun.util.logging.PlatformLogger log;
|
||||
private static final sun.util.logging.PlatformLogger LOG;
|
||||
|
||||
static {
|
||||
if (MarlinConst.useLogger) {
|
||||
log = sun.util.logging.PlatformLogger.getLogger("sun.java2d.marlin");
|
||||
if (MarlinConst.USE_LOGGER) {
|
||||
LOG = sun.util.logging.PlatformLogger.getLogger("sun.java2d.marlin");
|
||||
} else {
|
||||
log = null;
|
||||
LOG = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,18 +43,18 @@ public final class MarlinUtils {
|
||||
}
|
||||
|
||||
public static void logInfo(final String msg) {
|
||||
if (MarlinConst.useLogger) {
|
||||
log.info(msg);
|
||||
} else if (MarlinConst.enableLogs) {
|
||||
if (MarlinConst.USE_LOGGER) {
|
||||
LOG.info(msg);
|
||||
} else if (MarlinConst.ENABLE_LOGS) {
|
||||
System.out.print("INFO: ");
|
||||
System.out.println(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void logException(final String msg, final Throwable th) {
|
||||
if (MarlinConst.useLogger) {
|
||||
log.warning(msg, th);
|
||||
} else if (MarlinConst.enableLogs) {
|
||||
if (MarlinConst.USE_LOGGER) {
|
||||
LOG.warning(msg, th);
|
||||
} else if (MarlinConst.ENABLE_LOGS) {
|
||||
System.out.print("WARNING: ");
|
||||
System.out.println(msg);
|
||||
th.printStackTrace(System.err);
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package sun.java2d.marlin;
|
||||
|
||||
import static sun.java2d.marlin.MarlinConst.logUnsafeMalloc;
|
||||
import static sun.java2d.marlin.MarlinConst.LOG_UNSAFE_MALLOC;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import jdk.internal.ref.CleanerFactory;
|
||||
|
||||
@ -36,12 +36,12 @@ import jdk.internal.ref.CleanerFactory;
|
||||
final class OffHeapArray {
|
||||
|
||||
// unsafe reference
|
||||
static final Unsafe unsafe;
|
||||
static final Unsafe UNSAFE;
|
||||
// size of int / float
|
||||
static final int SIZE_INT;
|
||||
|
||||
static {
|
||||
unsafe = Unsafe.getUnsafe();
|
||||
UNSAFE = Unsafe.getUnsafe();
|
||||
SIZE_INT = Unsafe.ARRAY_INT_INDEX_SCALE;
|
||||
}
|
||||
|
||||
@ -52,10 +52,10 @@ final class OffHeapArray {
|
||||
|
||||
OffHeapArray(final Object parent, final long len) {
|
||||
// note: may throw OOME:
|
||||
this.address = unsafe.allocateMemory(len);
|
||||
this.address = UNSAFE.allocateMemory(len);
|
||||
this.length = len;
|
||||
this.used = 0;
|
||||
if (logUnsafeMalloc) {
|
||||
if (LOG_UNSAFE_MALLOC) {
|
||||
MarlinUtils.logInfo(System.currentTimeMillis()
|
||||
+ ": OffHeapArray.allocateMemory = "
|
||||
+ len + " to addr = " + this.address);
|
||||
@ -72,9 +72,9 @@ final class OffHeapArray {
|
||||
*/
|
||||
void resize(final long len) {
|
||||
// note: may throw OOME:
|
||||
this.address = unsafe.reallocateMemory(address, len);
|
||||
this.address = UNSAFE.reallocateMemory(address, len);
|
||||
this.length = len;
|
||||
if (logUnsafeMalloc) {
|
||||
if (LOG_UNSAFE_MALLOC) {
|
||||
MarlinUtils.logInfo(System.currentTimeMillis()
|
||||
+ ": OffHeapArray.reallocateMemory = "
|
||||
+ len + " to addr = " + this.address);
|
||||
@ -82,8 +82,8 @@ final class OffHeapArray {
|
||||
}
|
||||
|
||||
void free() {
|
||||
unsafe.freeMemory(this.address);
|
||||
if (logUnsafeMalloc) {
|
||||
UNSAFE.freeMemory(this.address);
|
||||
if (LOG_UNSAFE_MALLOC) {
|
||||
MarlinUtils.logInfo(System.currentTimeMillis()
|
||||
+ ": OffHeapArray.freeMemory = "
|
||||
+ this.length
|
||||
@ -92,6 +92,6 @@ final class OffHeapArray {
|
||||
}
|
||||
|
||||
void fill(final byte val) {
|
||||
unsafe.setMemory(this.address, this.length, val);
|
||||
UNSAFE.setMemory(this.address, this.length, val);
|
||||
}
|
||||
}
|
||||
|
@ -189,8 +189,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
maxDD /= 4f; // error divided by 2^2 = 4
|
||||
|
||||
count <<= 1;
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_quadBreak_dec.add(count);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_quadBreak_dec.add(count);
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,15 +214,15 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
|
||||
addLine(x0, y0, x1, y1);
|
||||
|
||||
if (doStats) { nL++; }
|
||||
if (DO_STATS) { nL++; }
|
||||
x0 = x1;
|
||||
y0 = y1;
|
||||
}
|
||||
}
|
||||
addLine(x0, y0, x2, y2);
|
||||
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_quadBreak.add(nL + 1);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_quadBreak.add(nL + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,8 +268,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
dy = (dy - ddy) / 2f;
|
||||
|
||||
count <<= 1;
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_curveBreak_dec.add(count);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_curveBreak_dec.add(count);
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,8 +289,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
dddy *= 8f;
|
||||
|
||||
count >>= 1;
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_curveBreak_inc.add(count);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_curveBreak_inc.add(count);
|
||||
}
|
||||
}
|
||||
if (--count > 0) {
|
||||
@ -307,21 +307,21 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
|
||||
addLine(x0, y0, x1, y1);
|
||||
|
||||
if (doStats) { nL++; }
|
||||
if (DO_STATS) { nL++; }
|
||||
x0 = x1;
|
||||
y0 = y1;
|
||||
}
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_curveBreak.add(nL);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_curveBreak.add(nL);
|
||||
}
|
||||
}
|
||||
|
||||
private void addLine(float x1, float y1, float x2, float y2) {
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_rdr_addLine.start();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_rdr_addLine.start();
|
||||
}
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_addLine.add(1);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_addLine.add(1);
|
||||
}
|
||||
int or = 1; // orientation of the line. 1 if y increases, 0 otherwise.
|
||||
if (y2 < y1) {
|
||||
@ -349,11 +349,11 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
/* skip horizontal lines in pixel space and clip edges
|
||||
out of y range [boundsMinY; boundsMaxY] */
|
||||
if (firstCrossing >= lastCrossing) {
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_rdr_addLine.stop();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_rdr_addLine.stop();
|
||||
}
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_addLine_skip.add(1);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_addLine_skip.add(1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -405,14 +405,14 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
final long edgeNewSize = ArrayCache.getNewLargeSize(_edges.length,
|
||||
edgePtr + _SIZEOF_EDGE_BYTES);
|
||||
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_edges_resizes.add(edgeNewSize);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_edges_resizes.add(edgeNewSize);
|
||||
}
|
||||
_edges.resize(edgeNewSize);
|
||||
}
|
||||
|
||||
|
||||
final Unsafe _unsafe = OffHeapArray.unsafe;
|
||||
final Unsafe _unsafe = OffHeapArray.UNSAFE;
|
||||
final long SIZE_INT = 4L;
|
||||
long addr = _edges.address + edgePtr;
|
||||
|
||||
@ -486,8 +486,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
// update free pointer (ie length in bytes)
|
||||
_edges.used += _SIZEOF_EDGE_BYTES;
|
||||
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_rdr_addLine.stop();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_rdr_addLine.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -552,7 +552,7 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
this.boundsMaxY =
|
||||
(pix_boundsY + pix_boundsHeight) << SUBPIXEL_LG_POSITIONS_Y;
|
||||
|
||||
if (doLogBounds) {
|
||||
if (DO_LOG_BOUNDS) {
|
||||
MarlinUtils.logInfo("boundsXY = [" + boundsMinX + " ... "
|
||||
+ boundsMaxX + "[ [" + boundsMinY + " ... "
|
||||
+ boundsMaxY + "[");
|
||||
@ -563,10 +563,10 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
final int edgeBucketsLength = (boundsMaxY - boundsMinY) + 1;
|
||||
|
||||
if (edgeBucketsLength > INITIAL_BUCKET_ARRAY) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_array_renderer_edgeBuckets
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_array_renderer_edgeBuckets
|
||||
.add(edgeBucketsLength);
|
||||
RendererContext.stats.stat_array_renderer_edgeBucketCounts
|
||||
rdrCtx.stats.stat_array_renderer_edgeBucketCounts
|
||||
.add(edgeBucketsLength);
|
||||
}
|
||||
edgeBuckets = rdrCtx.getIntArray(edgeBucketsLength);
|
||||
@ -592,13 +592,13 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
* Disposes this renderer and recycle it clean up before reusing this instance
|
||||
*/
|
||||
void dispose() {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_activeEdges.add(activeEdgeMaxUsed);
|
||||
RendererContext.stats.stat_rdr_edges.add(edges.used);
|
||||
RendererContext.stats.stat_rdr_edges_count
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_activeEdges.add(activeEdgeMaxUsed);
|
||||
rdrCtx.stats.stat_rdr_edges.add(edges.used);
|
||||
rdrCtx.stats.stat_rdr_edges_count
|
||||
.add(edges.used / SIZEOF_EDGE_BYTES);
|
||||
}
|
||||
if (doCleanDirty) {
|
||||
if (DO_CLEAN_DIRTY) {
|
||||
// Force zero-fill dirty arrays:
|
||||
Arrays.fill(crossings, 0);
|
||||
Arrays.fill(aux_crossings, 0);
|
||||
@ -670,12 +670,12 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
// note: may throw OOME:
|
||||
edges.resize(INITIAL_EDGES_CAPACITY);
|
||||
}
|
||||
if (doCleanDirty) {
|
||||
if (DO_CLEAN_DIRTY) {
|
||||
// Force zero-fill dirty arrays:
|
||||
edges.fill(BYTE_0);
|
||||
}
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_rdr_endRendering.stop();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_rdr_endRendering.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -793,7 +793,7 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
final int _ERR_STEP_MAX = ERR_STEP_MAX;
|
||||
|
||||
// unsafe I/O:
|
||||
final Unsafe _unsafe = OffHeapArray.unsafe;
|
||||
final Unsafe _unsafe = OffHeapArray.UNSAFE;
|
||||
final long addr0 = _edges.address;
|
||||
long addr;
|
||||
final int _SUBPIXEL_LG_POSITIONS_X = SUBPIXEL_LG_POSITIONS_X;
|
||||
@ -856,8 +856,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
|
||||
// bucketCount indicates new edge / edge end:
|
||||
if (bucketcount != 0) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_activeEdges_updates
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_activeEdges_updates
|
||||
.add(numCrossings);
|
||||
}
|
||||
|
||||
@ -882,19 +882,19 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
ptrLen = bucketcount >> 1; // number of new edge
|
||||
|
||||
if (ptrLen != 0) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_activeEdges_adds
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_activeEdges_adds
|
||||
.add(ptrLen);
|
||||
if (ptrLen > 10) {
|
||||
RendererContext.stats.stat_rdr_activeEdges_adds_high
|
||||
rdrCtx.stats.stat_rdr_activeEdges_adds_high
|
||||
.add(ptrLen);
|
||||
}
|
||||
}
|
||||
ptrEnd = numCrossings + ptrLen;
|
||||
|
||||
if (edgePtrsLen < ptrEnd) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_array_renderer_edgePtrs
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_array_renderer_edgePtrs
|
||||
.add(ptrEnd);
|
||||
}
|
||||
this.edgePtrs = _edgePtrs
|
||||
@ -908,8 +908,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
}
|
||||
// use ArrayCache.getNewSize() to use the same growing
|
||||
// factor than widenDirtyIntArray():
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_array_renderer_aux_edgePtrs
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_array_renderer_aux_edgePtrs
|
||||
.add(ptrEnd);
|
||||
}
|
||||
this.aux_edgePtrs = _aux_edgePtrs
|
||||
@ -936,8 +936,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
if (_crossings != crossings_initial) {
|
||||
rdrCtx.putDirtyIntArray(_crossings);
|
||||
}
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_array_renderer_crossings
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_array_renderer_crossings
|
||||
.add(numCrossings);
|
||||
}
|
||||
this.crossings = _crossings
|
||||
@ -947,8 +947,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
if (_aux_crossings != aux_crossings_initial) {
|
||||
rdrCtx.putDirtyIntArray(_aux_crossings);
|
||||
}
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_array_renderer_aux_crossings
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_array_renderer_aux_crossings
|
||||
.add(numCrossings);
|
||||
}
|
||||
this.aux_crossings = _aux_crossings
|
||||
@ -956,7 +956,7 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
|
||||
crossingsLen = _crossings.length;
|
||||
}
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
// update max used mark
|
||||
if (numCrossings > _arrayMaxUsed) {
|
||||
_arrayMaxUsed = numCrossings;
|
||||
@ -972,10 +972,10 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
* for newly added edges + final merge pass.
|
||||
*/
|
||||
if ((ptrLen < 10) || (numCrossings < 40)) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.hist_rdr_crossings
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.hist_rdr_crossings
|
||||
.add(numCrossings);
|
||||
RendererContext.stats.hist_rdr_crossings_adds
|
||||
rdrCtx.stats.hist_rdr_crossings_adds
|
||||
.add(ptrLen);
|
||||
}
|
||||
|
||||
@ -1018,23 +1018,23 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
_unsafe.putInt(addr, curx - ((err >> 30) & _ALL_BUT_LSB));
|
||||
_unsafe.putInt(addr + _OFF_ERROR, (err & _ERR_STEP_MAX));
|
||||
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_crossings_updates
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_crossings_updates
|
||||
.add(numCrossings);
|
||||
}
|
||||
|
||||
// insertion sort of crossings:
|
||||
if (cross < lastCross) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_crossings_sorts
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_crossings_sorts
|
||||
.add(i);
|
||||
}
|
||||
|
||||
/* use binary search for newly added edges
|
||||
in crossings if arrays are large enough */
|
||||
if (useBinarySearch && (i >= prevNumCrossings)) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.
|
||||
stat_rdr_crossings_bsearch.add(i);
|
||||
}
|
||||
low = 0;
|
||||
@ -1077,14 +1077,14 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_crossings_msorts
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_crossings_msorts
|
||||
.add(numCrossings);
|
||||
RendererContext.stats.hist_rdr_crossings_ratio
|
||||
rdrCtx.stats.hist_rdr_crossings_ratio
|
||||
.add((1000 * ptrLen) / numCrossings);
|
||||
RendererContext.stats.hist_rdr_crossings_msorts
|
||||
rdrCtx.stats.hist_rdr_crossings_msorts
|
||||
.add(numCrossings);
|
||||
RendererContext.stats.hist_rdr_crossings_msorts_adds
|
||||
rdrCtx.stats.hist_rdr_crossings_msorts_adds
|
||||
.add(ptrLen);
|
||||
}
|
||||
|
||||
@ -1124,8 +1124,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
_unsafe.putInt(addr, curx - ((err >> 30) & _ALL_BUT_LSB));
|
||||
_unsafe.putInt(addr + _OFF_ERROR, (err & _ERR_STEP_MAX));
|
||||
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_crossings_updates
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_crossings_updates
|
||||
.add(numCrossings);
|
||||
}
|
||||
|
||||
@ -1135,8 +1135,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
_crossings[i] = cross;
|
||||
|
||||
} else if (cross < lastCross) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_crossings_sorts
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_crossings_sorts
|
||||
.add(i);
|
||||
}
|
||||
|
||||
@ -1356,10 +1356,10 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
useBlkFlags = (maxX > _BLK_SIZE) && (maxX >
|
||||
(((numCrossings >> stroking) - 1) << _BLK_SIZE_LG));
|
||||
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
tmp = FloatMath.max(1,
|
||||
((numCrossings >> stroking) - 1));
|
||||
RendererContext.stats.hist_tile_generator_encoding_dist
|
||||
rdrCtx.stats.hist_tile_generator_encoding_dist
|
||||
.add(maxX / tmp);
|
||||
}
|
||||
}
|
||||
@ -1392,15 +1392,15 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
edgeCount = numCrossings;
|
||||
prevUseBlkFlags = useBlkFlags;
|
||||
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
// update max used mark
|
||||
activeEdgeMaxUsed = _arrayMaxUsed;
|
||||
}
|
||||
}
|
||||
|
||||
boolean endRendering() {
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_rdr_endRendering.start();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_rdr_endRendering.start();
|
||||
}
|
||||
if (edgeMinY == Integer.MAX_VALUE) {
|
||||
return false; // undefined edges bounds
|
||||
@ -1427,7 +1427,7 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
buckets_minY = spminY - _boundsMinY;
|
||||
buckets_maxY = maxY - _boundsMinY;
|
||||
|
||||
if (doLogBounds) {
|
||||
if (DO_LOG_BOUNDS) {
|
||||
MarlinUtils.logInfo("edgesXY = [" + edgeMinX + " ... " + edgeMaxX
|
||||
+ "][" + edgeMinY + " ... " + edgeMaxY + "]");
|
||||
MarlinUtils.logInfo("spXY = [" + spminX + " ... " + spmaxX
|
||||
@ -1479,7 +1479,7 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
// exclusive:
|
||||
bbox_spmaxY = FloatMath.min(spmaxY + 1, pmaxY << SUBPIXEL_LG_POSITIONS_Y);
|
||||
|
||||
if (doLogBounds) {
|
||||
if (DO_LOG_BOUNDS) {
|
||||
MarlinUtils.logInfo("pXY = [" + pminX + " ... " + pmaxX
|
||||
+ "[ [" + pminY + " ... " + pmaxY + "[");
|
||||
MarlinUtils.logInfo("bbox_spXY = [" + bbox_spminX + " ... "
|
||||
@ -1493,8 +1493,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
|
||||
// Useful when processing tile line by tile line
|
||||
if (width > INITIAL_AA_ARRAY) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_array_renderer_alphaline
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_array_renderer_alphaline
|
||||
.add(width);
|
||||
}
|
||||
alphaLine = rdrCtx.getIntArray(width);
|
||||
@ -1509,8 +1509,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
private int bbox_spminX, bbox_spmaxX, bbox_spminY, bbox_spmaxY;
|
||||
|
||||
void endRendering(final int pminY) {
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_rdr_endRendering_Y.start();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_rdr_endRendering_Y.start();
|
||||
}
|
||||
|
||||
final int spminY = pminY << SUBPIXEL_LG_POSITIONS_Y;
|
||||
@ -1527,8 +1527,8 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
// Process only one tile line:
|
||||
_endRendering(fixed_spminY, spmaxY);
|
||||
}
|
||||
if (doMonitors) {
|
||||
RendererContext.stats.mon_rdr_endRendering_Y.stop();
|
||||
if (DO_MONITORS) {
|
||||
rdrCtx.stats.mon_rdr_endRendering_Y.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1544,13 +1544,13 @@ final class Renderer implements PathConsumer2D, MarlinConst {
|
||||
final boolean useBlockFlags)
|
||||
{
|
||||
if (useBlockFlags) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.hist_tile_generator_encoding.add(1);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.hist_tile_generator_encoding.add(1);
|
||||
}
|
||||
cache.copyAARowRLE_WithBlockFlags(blkFlags, alphaRow, pix_y, pix_from, pix_to);
|
||||
} else {
|
||||
if (doStats) {
|
||||
RendererContext.stats.hist_tile_generator_encoding.add(0);
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.hist_tile_generator_encoding.add(0);
|
||||
}
|
||||
cache.copyAARowNoRLE(alphaRow, pix_y, pix_from, pix_to);
|
||||
}
|
||||
|
@ -40,12 +40,12 @@ import static sun.java2d.marlin.MarlinUtils.logInfo;
|
||||
final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
|
||||
// RendererContext creation counter
|
||||
private static final AtomicInteger contextCount = new AtomicInteger(1);
|
||||
private static final AtomicInteger CTX_COUNT = new AtomicInteger(1);
|
||||
// RendererContext statistics
|
||||
static final RendererStats stats = (doStats || doMonitors)
|
||||
final RendererStats stats = (DO_STATS || DO_MONITORS)
|
||||
? RendererStats.getInstance(): null;
|
||||
|
||||
private static final boolean USE_CACHE_HARD_REF = doStats
|
||||
private static final boolean USE_CACHE_HARD_REF = DO_STATS
|
||||
|| (MarlinRenderingEngine.REF_TYPE == ReentrantContextProvider.REF_WEAK);
|
||||
|
||||
/**
|
||||
@ -55,10 +55,10 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
*/
|
||||
static RendererContext createContext() {
|
||||
final RendererContext newCtx = new RendererContext("ctx"
|
||||
+ Integer.toString(contextCount.getAndIncrement()));
|
||||
+ Integer.toString(CTX_COUNT.getAndIncrement()));
|
||||
|
||||
if (RendererContext.stats != null) {
|
||||
RendererContext.stats.allContexts.add(newCtx);
|
||||
if (DO_STATS || DO_MONITORS) {
|
||||
RendererStats.ALL_CONTEXTS.add(newCtx);
|
||||
}
|
||||
return newCtx;
|
||||
}
|
||||
@ -101,7 +101,7 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
* @param name context name (debugging)
|
||||
*/
|
||||
RendererContext(final String name) {
|
||||
if (logCreateContext) {
|
||||
if (LOG_CREATE_CONTEXT) {
|
||||
MarlinUtils.logInfo("new RendererContext = " + name);
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
: null;
|
||||
// create a new ArrayCachesHolder if none is available
|
||||
if (holder == null) {
|
||||
if (logCreateContext) {
|
||||
if (LOG_CREATE_CONTEXT) {
|
||||
MarlinUtils.logInfo("new ArrayCachesHolder for "
|
||||
+ "RendererContext = " + name);
|
||||
}
|
||||
@ -192,11 +192,11 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
return getDirtyByteArrayCache(length).getArray();
|
||||
}
|
||||
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
incOversize();
|
||||
}
|
||||
|
||||
if (doLogOverSize) {
|
||||
if (DO_LOG_OVERSIZE) {
|
||||
logInfo("getDirtyByteArray[oversize]: length=\t" + length);
|
||||
}
|
||||
|
||||
@ -216,10 +216,10 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
final int usedSize, final int needSize)
|
||||
{
|
||||
final int length = in.length;
|
||||
if (doChecks && length >= needSize) {
|
||||
if (DO_CHECKS && length >= needSize) {
|
||||
return in;
|
||||
}
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
incResizeDirtyByte();
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
// NO clean-up of array data = DIRTY ARRAY
|
||||
putDirtyByteArray(in);
|
||||
|
||||
if (doLogWidenArray) {
|
||||
if (DO_LOG_WIDEN_ARRAY) {
|
||||
logInfo("widenDirtyByteArray[" + res.length + "]: usedSize=\t"
|
||||
+ usedSize + "\tlength=\t" + length + "\tneeded length=\t"
|
||||
+ needSize);
|
||||
@ -252,11 +252,11 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
return getIntArrayCache(length).getArray();
|
||||
}
|
||||
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
incOversize();
|
||||
}
|
||||
|
||||
if (doLogOverSize) {
|
||||
if (DO_LOG_OVERSIZE) {
|
||||
logInfo("getIntArray[oversize]: length=\t" + length);
|
||||
}
|
||||
|
||||
@ -268,10 +268,10 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
final int needSize, final int clearTo)
|
||||
{
|
||||
final int length = in.length;
|
||||
if (doChecks && length >= needSize) {
|
||||
if (DO_CHECKS && length >= needSize) {
|
||||
return in;
|
||||
}
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
incResizeInt();
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
// maybe return current array:
|
||||
putIntArray(in, 0, clearTo); // ensure all array is cleared (grow-reduce algo)
|
||||
|
||||
if (doLogWidenArray) {
|
||||
if (DO_LOG_WIDEN_ARRAY) {
|
||||
logInfo("widenIntArray[" + res.length + "]: usedSize=\t"
|
||||
+ usedSize + "\tlength=\t" + length + "\tneeded length=\t"
|
||||
+ needSize);
|
||||
@ -314,11 +314,11 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
return getDirtyIntArrayCache(length).getArray();
|
||||
}
|
||||
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
incOversize();
|
||||
}
|
||||
|
||||
if (doLogOverSize) {
|
||||
if (DO_LOG_OVERSIZE) {
|
||||
logInfo("getDirtyIntArray[oversize]: length=\t" + length);
|
||||
}
|
||||
|
||||
@ -329,10 +329,10 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
final int usedSize, final int needSize)
|
||||
{
|
||||
final int length = in.length;
|
||||
if (doChecks && length >= needSize) {
|
||||
if (DO_CHECKS && length >= needSize) {
|
||||
return in;
|
||||
}
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
incResizeDirtyInt();
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
// NO clean-up of array data = DIRTY ARRAY
|
||||
putDirtyIntArray(in);
|
||||
|
||||
if (doLogWidenArray) {
|
||||
if (DO_LOG_WIDEN_ARRAY) {
|
||||
logInfo("widenDirtyIntArray[" + res.length + "]: usedSize=\t"
|
||||
+ usedSize + "\tlength=\t" + length + "\tneeded length=\t"
|
||||
+ needSize);
|
||||
@ -374,11 +374,11 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
return getDirtyFloatArrayCache(length).getArray();
|
||||
}
|
||||
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
incOversize();
|
||||
}
|
||||
|
||||
if (doLogOverSize) {
|
||||
if (DO_LOG_OVERSIZE) {
|
||||
logInfo("getDirtyFloatArray[oversize]: length=\t" + length);
|
||||
}
|
||||
|
||||
@ -389,10 +389,10 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
final int usedSize, final int needSize)
|
||||
{
|
||||
final int length = in.length;
|
||||
if (doChecks && length >= needSize) {
|
||||
if (DO_CHECKS && length >= needSize) {
|
||||
return in;
|
||||
}
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
incResizeDirtyFloat();
|
||||
}
|
||||
|
||||
@ -406,7 +406,7 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
|
||||
// NO clean-up of array data = DIRTY ARRAY
|
||||
putDirtyFloatArray(in);
|
||||
|
||||
if (doLogWidenArray) {
|
||||
if (DO_LOG_WIDEN_ARRAY) {
|
||||
logInfo("widenDirtyFloatArray[" + res.length + "]: usedSize=\t"
|
||||
+ usedSize + "\tlength=\t" + length + "\tneeded length=\t"
|
||||
+ needSize);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -42,24 +42,24 @@ import sun.awt.util.ThreadGroupUtils;
|
||||
public final class RendererStats implements MarlinConst {
|
||||
|
||||
// singleton
|
||||
private static volatile RendererStats singleton = null;
|
||||
private static volatile RendererStats SINGLETON = null;
|
||||
|
||||
static RendererStats getInstance() {
|
||||
if (singleton == null) {
|
||||
singleton = new RendererStats();
|
||||
if (SINGLETON == null) {
|
||||
SINGLETON = new RendererStats();
|
||||
}
|
||||
return singleton;
|
||||
return SINGLETON;
|
||||
}
|
||||
|
||||
public static void dumpStats() {
|
||||
if (singleton != null) {
|
||||
singleton.dump();
|
||||
if (SINGLETON != null) {
|
||||
SINGLETON.dump();
|
||||
}
|
||||
}
|
||||
|
||||
/* RendererContext collection as hard references
|
||||
(only used for debugging purposes) */
|
||||
final ConcurrentLinkedQueue<RendererContext> allContexts
|
||||
static final ConcurrentLinkedQueue<RendererContext> ALL_CONTEXTS
|
||||
= new ConcurrentLinkedQueue<RendererContext>();
|
||||
// stats
|
||||
final StatLong stat_cache_rowAA
|
||||
@ -208,8 +208,6 @@ public final class RendererStats implements MarlinConst {
|
||||
// monitors
|
||||
final Monitor mon_pre_getAATileGenerator
|
||||
= new Monitor("MarlinRenderingEngine.getAATileGenerator()");
|
||||
final Monitor mon_npi_currentSegment
|
||||
= new Monitor("NormalizingPathIterator.currentSegment()");
|
||||
final Monitor mon_rdr_addLine
|
||||
= new Monitor("Renderer.addLine()");
|
||||
final Monitor mon_rdr_endRendering
|
||||
@ -227,7 +225,6 @@ public final class RendererStats implements MarlinConst {
|
||||
// all monitors
|
||||
final Monitor[] monitors = new Monitor[]{
|
||||
mon_pre_getAATileGenerator,
|
||||
mon_npi_currentSegment,
|
||||
mon_rdr_addLine,
|
||||
mon_rdr_endRendering,
|
||||
mon_rdr_endRendering_Y,
|
||||
@ -255,14 +252,14 @@ public final class RendererStats implements MarlinConst {
|
||||
hook.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(hook);
|
||||
|
||||
if (useDumpThread) {
|
||||
if (USE_DUMP_THREAD) {
|
||||
final Timer statTimer = new Timer("RendererStats");
|
||||
statTimer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
dump();
|
||||
}
|
||||
}, statDump, statDump);
|
||||
}, DUMP_INTERVAL, DUMP_INTERVAL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -270,15 +267,13 @@ public final class RendererStats implements MarlinConst {
|
||||
}
|
||||
|
||||
void dump() {
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
ArrayCache.dumpStats();
|
||||
}
|
||||
final RendererContext[] all = allContexts.toArray(
|
||||
new RendererContext[allContexts.size()]);
|
||||
for (RendererContext rdrCtx : all) {
|
||||
for (RendererContext rdrCtx : ALL_CONTEXTS) {
|
||||
logInfo("RendererContext: " + rdrCtx.name);
|
||||
|
||||
if (doMonitors) {
|
||||
if (DO_MONITORS) {
|
||||
for (Monitor monitor : monitors) {
|
||||
if (monitor.count != 0) {
|
||||
logInfo(monitor.toString());
|
||||
@ -292,14 +287,14 @@ public final class RendererStats implements MarlinConst {
|
||||
+ ((100d * monitor.sum) / total) + " %");
|
||||
}
|
||||
}
|
||||
if (doFlushMonitors) {
|
||||
if (DO_FLUSH_MONITORS) {
|
||||
for (Monitor m : monitors) {
|
||||
m.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
for (StatLong stat : statistics) {
|
||||
if (stat.count != 0) {
|
||||
logInfo(stat.toString());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@ -180,7 +180,7 @@ final class Stroker implements PathConsumer2D, MarlinConst {
|
||||
void dispose() {
|
||||
reverse.dispose();
|
||||
|
||||
if (doCleanDirty) {
|
||||
if (DO_CLEAN_DIRTY) {
|
||||
// Force zero-fill dirty arrays:
|
||||
Arrays.fill(offset0, 0f);
|
||||
Arrays.fill(offset1, 0f);
|
||||
@ -226,7 +226,7 @@ final class Stroker implements PathConsumer2D, MarlinConst {
|
||||
boolean rev,
|
||||
float threshold)
|
||||
{
|
||||
if ((omx == 0 && omy == 0) || (mx == 0 && my == 0)) {
|
||||
if ((omx == 0f && omy == 0f) || (mx == 0f && my == 0f)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -338,12 +338,14 @@ final class Stroker implements PathConsumer2D, MarlinConst {
|
||||
}
|
||||
|
||||
private void drawRoundCap(float cx, float cy, float mx, float my) {
|
||||
emitCurveTo(cx+mx-C*my, cy+my+C*mx,
|
||||
cx-my+C*mx, cy+mx+C*my,
|
||||
cx-my, cy+mx);
|
||||
emitCurveTo(cx-my-C*mx, cy+mx-C*my,
|
||||
cx-mx-C*my, cy-my+C*mx,
|
||||
cx-mx, cy-my);
|
||||
final float Cmx = C * mx;
|
||||
final float Cmy = C * my;
|
||||
emitCurveTo(cx + mx - Cmy, cy + my + Cmx,
|
||||
cx - my + Cmx, cy + mx + Cmy,
|
||||
cx - my, cy + mx);
|
||||
emitCurveTo(cx - my - Cmx, cy + mx - Cmy,
|
||||
cx - mx - Cmy, cy - my + Cmx,
|
||||
cx - mx, cy - my);
|
||||
}
|
||||
|
||||
// Put the intersection point of the lines (x0, y0) -> (x1, y1)
|
||||
@ -412,8 +414,8 @@ final class Stroker implements PathConsumer2D, MarlinConst {
|
||||
}
|
||||
this.sx0 = this.cx0 = x0;
|
||||
this.sy0 = this.cy0 = y0;
|
||||
this.cdx = this.sdx = 1;
|
||||
this.cdy = this.sdy = 0;
|
||||
this.cdx = this.sdx = 1f;
|
||||
this.cdy = this.sdy = 0f;
|
||||
this.prev = MOVE_TO;
|
||||
}
|
||||
|
||||
@ -452,10 +454,10 @@ final class Stroker implements PathConsumer2D, MarlinConst {
|
||||
return;
|
||||
}
|
||||
emitMoveTo(cx0, cy0 - lineWidth2);
|
||||
this.cmx = this.smx = 0;
|
||||
this.cmx = this.smx = 0f;
|
||||
this.cmy = this.smy = -lineWidth2;
|
||||
this.cdx = this.sdx = 1;
|
||||
this.cdy = this.sdy = 0;
|
||||
this.cdx = this.sdx = 1f;
|
||||
this.cdy = this.sdy = 0f;
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
@ -1232,7 +1234,7 @@ final class Stroker implements PathConsumer2D, MarlinConst {
|
||||
end = 0;
|
||||
numCurves = 0;
|
||||
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
curveTypesUseMark = 0;
|
||||
curvesUseMark = 0;
|
||||
}
|
||||
@ -1246,10 +1248,10 @@ final class Stroker implements PathConsumer2D, MarlinConst {
|
||||
end = 0;
|
||||
numCurves = 0;
|
||||
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_rdr_poly_stack_types
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_rdr_poly_stack_types
|
||||
.add(curveTypesUseMark);
|
||||
RendererContext.stats.stat_rdr_poly_stack_curves
|
||||
rdrCtx.stats.stat_rdr_poly_stack_curves
|
||||
.add(curvesUseMark);
|
||||
// reset marks
|
||||
curveTypesUseMark = 0;
|
||||
@ -1272,15 +1274,15 @@ final class Stroker implements PathConsumer2D, MarlinConst {
|
||||
private void ensureSpace(final int n) {
|
||||
// use substraction to avoid integer overflow:
|
||||
if (curves.length - end < n) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_array_stroker_polystack_curves
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_array_stroker_polystack_curves
|
||||
.add(end + n);
|
||||
}
|
||||
curves = rdrCtx.widenDirtyFloatArray(curves, end, end + n);
|
||||
}
|
||||
if (curveTypes.length <= numCurves) {
|
||||
if (doStats) {
|
||||
RendererContext.stats.stat_array_stroker_polystack_curveTypes
|
||||
if (DO_STATS) {
|
||||
rdrCtx.stats.stat_array_stroker_polystack_curveTypes
|
||||
.add(numCurves + 1);
|
||||
}
|
||||
curveTypes = rdrCtx.widenDirtyByteArray(curveTypes,
|
||||
@ -1323,7 +1325,7 @@ final class Stroker implements PathConsumer2D, MarlinConst {
|
||||
}
|
||||
|
||||
void popAll(PathConsumer2D io) {
|
||||
if (doStats) {
|
||||
if (DO_STATS) {
|
||||
// update used marks:
|
||||
if (numCurves > curveTypesUseMark) {
|
||||
curveTypesUseMark = numCurves;
|
||||
|
@ -27,10 +27,10 @@ package sun.java2d.marlin;
|
||||
|
||||
public final class Version {
|
||||
|
||||
private static final String version = "marlin-0.7.3.3-Unsafe-OpenJDK";
|
||||
private static final String VERSION = "marlin-0.7.3.4-Unsafe-OpenJDK";
|
||||
|
||||
public static String getVersion() {
|
||||
return version;
|
||||
return VERSION;
|
||||
}
|
||||
|
||||
private Version() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
package sun.java2d.marlin.stats;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Generic histogram based on long statistics
|
||||
*/
|
||||
|
@ -44,10 +44,10 @@ import sun.java2d.SunGraphics2D;
|
||||
public final class AAShapePipe
|
||||
implements ShapeDrawPipe, ParallelogramPipe
|
||||
{
|
||||
static final RenderingEngine renderengine = RenderingEngine.getInstance();
|
||||
static final RenderingEngine RDR_ENGINE = RenderingEngine.getInstance();
|
||||
|
||||
// Per-thread TileState (~1K very small so do not use any Weak Reference)
|
||||
private static final ReentrantContextProvider<TileState> tileStateProvider =
|
||||
private static final ReentrantContextProvider<TileState> TILE_STATE_PROVIDER =
|
||||
new ReentrantContextProviderTL<TileState>(
|
||||
ReentrantContextProvider.REF_HARD)
|
||||
{
|
||||
@ -90,19 +90,19 @@ public final class AAShapePipe
|
||||
double dx1, double dy1,
|
||||
double dx2, double dy2)
|
||||
{
|
||||
final TileState ts = tileStateProvider.acquire();
|
||||
final TileState ts = TILE_STATE_PROVIDER.acquire();
|
||||
try {
|
||||
final int[] abox = ts.abox;
|
||||
|
||||
final AATileGenerator aatg =
|
||||
renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, 0, 0,
|
||||
RDR_ENGINE.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, 0, 0,
|
||||
sg.getCompClip(), abox);
|
||||
if (aatg != null) {
|
||||
renderTiles(sg, ts.computeBBox(ux1, uy1, ux2, uy2),
|
||||
aatg, abox, ts);
|
||||
}
|
||||
} finally {
|
||||
tileStateProvider.release(ts);
|
||||
TILE_STATE_PROVIDER.release(ts);
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,12 +115,12 @@ public final class AAShapePipe
|
||||
double dx2, double dy2,
|
||||
double lw1, double lw2)
|
||||
{
|
||||
final TileState ts = tileStateProvider.acquire();
|
||||
final TileState ts = TILE_STATE_PROVIDER.acquire();
|
||||
try {
|
||||
final int[] abox = ts.abox;
|
||||
|
||||
final AATileGenerator aatg =
|
||||
renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, lw1,
|
||||
RDR_ENGINE.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, lw1,
|
||||
lw2, sg.getCompClip(), abox);
|
||||
if (aatg != null) {
|
||||
// Note that bbox is of the original shape, not the wide path.
|
||||
@ -129,7 +129,7 @@ public final class AAShapePipe
|
||||
aatg, abox, ts);
|
||||
}
|
||||
} finally {
|
||||
tileStateProvider.release(ts);
|
||||
TILE_STATE_PROVIDER.release(ts);
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,18 +138,18 @@ public final class AAShapePipe
|
||||
sg.strokeHint != SunHints.INTVAL_STROKE_PURE);
|
||||
final boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED);
|
||||
|
||||
final TileState ts = tileStateProvider.acquire();
|
||||
final TileState ts = TILE_STATE_PROVIDER.acquire();
|
||||
try {
|
||||
final int[] abox = ts.abox;
|
||||
|
||||
final AATileGenerator aatg =
|
||||
renderengine.getAATileGenerator(s, sg.transform, sg.getCompClip(),
|
||||
RDR_ENGINE.getAATileGenerator(s, sg.transform, sg.getCompClip(),
|
||||
bs, thin, adjust, abox);
|
||||
if (aatg != null) {
|
||||
renderTiles(sg, s, aatg, abox, ts);
|
||||
}
|
||||
} finally {
|
||||
tileStateProvider.release(ts);
|
||||
TILE_STATE_PROVIDER.release(ts);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user