Reduce heap memory allocation on render path (less heap junk) by

replacing java.awt.Color with work-alike, lightweight updatable
alternative.
This commit is contained in:
Mike Primm 2011-05-15 22:25:45 -05:00
parent 355d54842f
commit 271990b87c
6 changed files with 109 additions and 57 deletions

View file

@ -1,6 +1,6 @@
package org.dynmap.kzedmap;
import java.awt.Color;
import org.dynmap.Color;
import java.util.Map;
import org.bukkit.World;
@ -12,12 +12,12 @@ public class CaveTileRenderer extends DefaultTileRenderer {
}
@Override
protected Color scan(World world, int x, int y, int z, int seq, boolean isnether) {
protected void scan(World world, int x, int y, int z, int seq, boolean isnether, final Color result) {
boolean air = true;
result.setTransparent();
for (;;) {
if (y < 0)
return translucent;
return;
int id = world.getBlockTypeIdAt(x, y, z);
if(isnether) { /* Make ceiling into air in nether */
@ -93,7 +93,8 @@ public class CaveTileRenderer extends DefaultTileRenderer {
cg = cg * mult / 256;
cb = cb * mult / 256;
return new Color(cr, cg, cb);
result.setRGBA(cr, cg, cb, 255);
return;
}
}
}