Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
Do not create new Color for the FeatureShakemap.render
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgenii Komrakov committed Apr 28, 2024
1 parent b980a36 commit e80317c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,14 @@ public void render(GlobeRenderer renderer, Graphics2D graphics, RenderEntity<Int
return;
}

Color col = level.getColor();

graphics.setStroke(new BasicStroke(1.0f));
graphics.setColor(new Color(col.getRed(), col.getGreen(), col.getBlue(), 100));
graphics.setColor(level.getColorAlpha100());
graphics.fill(elementHex.getShape());

boolean mouseNearby = renderer.getLastMouse() != null && renderer.hasMouseMovedRecently() && elementHex.getShape().contains(renderer.getLastMouse());

if (mouseNearby && renderProperties.scroll < 0.2) {
graphics.setColor(col);
graphics.setColor(level.getColor());
graphics.setStroke(new BasicStroke(0.5f));
graphics.draw(elementHex.getShape());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ public final class Level {
private final String suffix;
private final double pga;
private final Color color;
private final Color colorAlpha100;
private final String fullName;

public Level(String name, String suffix, double pga, Color color) {
this.name = name;
this.suffix = suffix;
this.pga = pga;
this.color = color;
this.colorAlpha100 = (new Color(color.getRed(), color.getGreen(), color.getBlue(), 100));
this.fullName = "%s%s".formatted(getName(), getSuffix());
}

Expand All @@ -29,6 +31,10 @@ public Color getColor() {
return color;
}

public Color getColorAlpha100() {
return colorAlpha100;
}

public double getPga() {
return pga;
}
Expand Down

0 comments on commit e80317c

Please sign in to comment.