minor refactor

This commit is contained in:
Anthony Calosa
2025-07-04 22:45:50 +08:00
parent 05e20b4e92
commit bd0b8fbc65
4 changed files with 13 additions and 11 deletions

View File

@@ -460,8 +460,10 @@ public class ImageCache {
return i;
}
public boolean isFullBorder(String textureString) {
ImageRecord record = imageRecord.get().get(textureString);
public boolean isFullBorder(Texture image) {
if (image == null)
return false;
ImageRecord record = imageRecord.get().get(image.toString());
if (record == null)
return false;
return record.isFullBorder;

View File

@@ -49,7 +49,7 @@ public class CardImage implements FImage {
CardImageRenderer.drawCardImage(g, cv, false, x, y, w, h, CardStackPosition.Top, true, true);
} else {
if (Forge.enableUIMask.equals("Full")) {
if (ImageCache.getInstance().isFullBorder(image.toString()))
if (ImageCache.getInstance().isFullBorder(image))
g.drawCardRoundRect(image, null, x, y, w, h, false, false);
else {
float radius = (h - w) / 8;

View File

@@ -814,7 +814,7 @@ public class CardImageRenderer {
}
if (rotatePlane && (card.getCurrentState().isPhenomenon() || card.getCurrentState().isPlane() || (card.getCurrentState().isBattle() && !altState) || (card.getAlternateState() != null && card.getAlternateState().isBattle() && altState))) {
if (Forge.enableUIMask.equals("Full")) {
if (ImageCache.getInstance().isFullBorder(image.toString()))
if (ImageCache.getInstance().isFullBorder(image))
g.drawCardRoundRect(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90);
else {
g.drawRotatedImage(FSkin.getBorders().get(0), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90);
@@ -827,7 +827,7 @@ public class CardImageRenderer {
} else if (rotateSplit && isCurrentCard && card.isSplitCard() && canshow && !card.isFaceDown()) {
boolean isAftermath = card.getText().contains("Aftermath") || card.getAlternateState().getOracleText().contains("Aftermath");
if (Forge.enableUIMask.equals("Full")) {
if (ImageCache.getInstance().isFullBorder(image.toString()))
if (ImageCache.getInstance().isFullBorder(image))
g.drawCardRoundRect(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
else {
g.drawRotatedImage(FSkin.getBorders().get(ImageCache.getInstance().getFSkinBorders(card)), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
@@ -843,7 +843,7 @@ public class CardImageRenderer {
if (card.isSplitCard() && rotateSplit && isCurrentCard) {
boolean isAftermath = card.getText().contains("Aftermath") || card.getAlternateState().getOracleText().contains("Aftermath");
if (Forge.enableUIMask.equals("Full")) {
if (ImageCache.getInstance().isFullBorder(image.toString()))
if (ImageCache.getInstance().isFullBorder(image))
g.drawCardRoundRect(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
else {
g.drawRotatedImage(FSkin.getBorders().get(ImageCache.getInstance().getFSkinBorders(card)), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
@@ -855,7 +855,7 @@ public class CardImageRenderer {
g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
} else {
if (Forge.enableUIMask.equals("Full")) {
if (ImageCache.getInstance().isFullBorder(image.toString()))
if (ImageCache.getInstance().isFullBorder(image))
g.drawCardRoundRect(image, null, x, y, w, h, false, false);
else {
g.drawImage(ImageCache.getInstance().getBorderImage(image.toString()), ImageCache.getInstance().borderColor(image), x, y, w, h);
@@ -872,7 +872,7 @@ public class CardImageRenderer {
g.drawImage(sleeves, x, y, w, h);
}
} else if (Forge.enableUIMask.equals("Full") && canshow) {
if (ImageCache.getInstance().isFullBorder(image.toString()))
if (ImageCache.getInstance().isFullBorder(image))
g.drawCardRoundRect(image, null, x, y, w, h, false, false);
else {
g.drawImage(ImageCache.getInstance().getBorderImage(image.toString()), ImageCache.getInstance().borderColor(image), x, y, w, h);

View File

@@ -610,7 +610,7 @@ public class CardRenderer {
CardImageRenderer.drawCardImage(g, CardView.getCardForUi(pc), false, x, y, w, h, pos, true, true);
} else {
if (Forge.enableUIMask.equals("Full")) {
if (ImageCache.getInstance().isFullBorder(image.toString()))
if (ImageCache.getInstance().isFullBorder(image))
g.drawCardRoundRect(image, null, x, y, w, h, false, false);
else {
//tint the border
@@ -663,7 +663,7 @@ public class CardRenderer {
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ROTATE_PLANE_OR_PHENOMENON)
&& (card.getCurrentState().isPhenomenon() || card.getCurrentState().isPlane() || (card.getCurrentState().isBattle() && !showAltState) || (card.getAlternateState() != null && card.getAlternateState().isBattle() && showAltState)) && rotate) {
if (Forge.enableUIMask.equals("Full")) {
if (ImageCache.getInstance().isFullBorder(image.toString()))
if (ImageCache.getInstance().isFullBorder(image))
g.drawCardRoundRect(image, x, y, w, h, x + w / 2, y + h / 2, -90);
else {
g.drawRotatedImage(FSkin.getBorders().get(0), x, y, w, h, x + w / 2, y + h / 2, -90);
@@ -675,7 +675,7 @@ public class CardRenderer {
g.drawRotatedImage(image, x, y, w, h, x + w / 2, y + h / 2, -90);
} else {
if (Forge.enableUIMask.equals("Full") && canshow) {
if (ImageCache.getInstance().isFullBorder(image.toString()))
if (ImageCache.getInstance().isFullBorder(image))
g.drawCardRoundRect(image, crack_overlay, x, y, w, h, drawGray(card), magnify ? false : card.getDamage() > 0);
else {
//boolean t = (card.getCurrentState().getOriginalColors() != card.getCurrentState().getColors()) || card.getCurrentState().hasChangeColors();