Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bourgesl committed Mar 4, 2014
1 parent fc114b1 commit 5f91629
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 934 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<url>https://github.com/bourgesl/marlin-renderer</url>

<description>
A pure Java renderer, derived from OpenJDK Pisces
A pure Java renderer, derived from OpenJDK Pisces (GPL2+CP)
</description>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/marlin/pisces/ArrayCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public final class ArrayCache implements PiscesConst {
static {
/* initialize buckets for int/float arrays */
int arraySize = MIN_ARRAY_SIZE;

for (int i = 0; i < BUCKETS; i++, arraySize *= BUCKET_GROW) {
ARRAY_SIZES[i] = arraySize;

Expand Down
13 changes: 0 additions & 13 deletions src/main/java/org/marlin/pisces/FastMath.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,6 @@ final class FastMath implements PiscesConst {
private FastMath() {
// utility class
}

/**
* Faster Math.round implementation
*
* @param x float number
* @return integer higher than given float number
*/
public static int round(final float x) {
if (useFastMath) {
return (int) (x + 0.5f);
}
return (int)Math.rint(x);
}

/**
* Faster Math.ceil implementation
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/marlin/pisces/Helpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static int cubicRootsInAB(float d, float a, float b, float c,
return filterOutNotInAB(pts, off, num, A, B) - off;
}

/* TODO: replace with new signature */
/* TODO: replace with new signature see: widenArrayPartially() */
static float[] widenArray(final RendererContext rdrCtx, final float[] in, final int cursize,
final int numToAdd, final int clearTo) {

Expand All @@ -171,7 +171,7 @@ static float[] widenArray(final RendererContext rdrCtx, final float[] in, final
return res;
}

/* TODO: replace with new signature */
/* TODO: replace with new signature see: widenArrayPartially() */
static int[] widenArray(final RendererContext rdrCtx, final int[] in, final int cursize,
final int numToAdd, final int clearTo) {

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/marlin/pisces/IntArrayCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ void dumpStats() {
IntArrayCache(final int arraySize) {
this.arraySize = arraySize;
this.intArrays = new ArrayDeque<int[]>(6); /* small but enough: almost 1 cache line */

}

int[] getArray() {
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/org/marlin/pisces/PiscesCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ public final class PiscesCache implements PiscesConst {
public static final int TILE_SIZE_LG = PiscesRenderingEngine.getTileSize_Log2();
public static final int TILE_SIZE = 1 << TILE_SIZE_LG; // 32 by default

/*
static final int MASK_ALPHA_COVERAGE = (0x80 + 0x7f);
*/

/* 2048 alpha values (width) x 32 rows (tile) = 256K */
static final int INITIAL_CHUNK_ARRAY = TILE_SIZE * INITIAL_PIXEL_DIM;

Expand Down Expand Up @@ -215,7 +211,6 @@ void copyAARow(final int[] alphaRow, final int y, final int px0, final int px1)

final int[] touchedLine = touchedTile;
final int _TILE_SIZE_LG = TILE_SIZE_LG;
// final int _MASK_ALPHA_COVERAGE = MASK_ALPHA_COVERAGE;

// fix offset in rowAAChunk:
final int off = pos + 2 - from;
Expand All @@ -226,7 +221,7 @@ void copyAARow(final int[] alphaRow, final int y, final int px0, final int px1)

/* ensure val is [0;64] */
// val &= _MASK_ALPHA_COVERAGE; /* use alpha mask to ensure values are in [0;64] range */

// store alpha sum:
_rowAAChunk[x + off] = val;

Expand Down
13 changes: 6 additions & 7 deletions src/main/java/org/marlin/pisces/PiscesConst.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
*
*/
interface PiscesConst {

/** enable JUL logger */
static final boolean useJUL = PiscesRenderingEngine.isUseJul();

Expand Down Expand Up @@ -75,14 +74,14 @@ interface PiscesConst {
static final boolean doLogBounds = false;

/* Initial Array sizing (initial context capacity) ~ 512K to 1 Mb */

/** 2048 pixel (width x height) for initial capacity */
static final int INITIAL_PIXEL_DIM = PiscesRenderingEngine.getInitialImageSize();
static final int INITIAL_PIXEL_DIM = PiscesRenderingEngine.getInitialImageSize();

/* only odd numbers allowed below */
static final int INITIAL_ARRAY = 256;
static final int INITIAL_ARRAY = 256;
static final int INITIAL_MEDIUM_ARRAY = 4096; // large enough to avoid 99% array resizing
static final int INITIAL_LARGE_ARRAY = 8192; // large enough to avoid 99% array resizing
static final int INITIAL_ARRAY_32K = 32768; // very large to avoid 99.99% array resizing
static final int INITIAL_AA_ARRAY = INITIAL_PIXEL_DIM; /* alpha row dimension */

static final int INITIAL_LARGE_ARRAY = 8192; // large enough to avoid 99% array resizing
static final int INITIAL_ARRAY_32K = 32768; // very large to avoid 99.99% array resizing
static final int INITIAL_AA_ARRAY = INITIAL_PIXEL_DIM; /* alpha row dimension */
}
Loading

0 comments on commit 5f91629

Please sign in to comment.