- Fix a possible IllegalArgumentException.

- Hotfix for foil cards: always use foil index '1' rather than a random foil (prevents flickering in deck editor).
This commit is contained in:
elcnesh
2014-09-25 14:59:52 +00:00
parent 54e29afe26
commit 5b84bdfb75
3 changed files with 10 additions and 4 deletions

View File

@@ -1102,7 +1102,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
if (paperCard.isFoil()) {
final CardView card = ViewUtil.getCardForUi(paperCard);
if (card.getOriginal().getFoilIndex() == 0) { //if foil finish not yet established, assign a random one
card.getOriginal().setRandomFoil();
card.getOriginal().setFoilIndex(1); // FIXME should assign a random foil here
}
CardPanel.drawFoilEffect(g, card, bounds.x, bounds.y, bounds.width, bounds.height, borderSize);
}

View File

@@ -84,7 +84,7 @@ public enum CPicture implements ICDoc {
final IPaperCard paperCard = ((IPaperCard)item);
final CardView c = ViewUtil.getCardForUi(paperCard);
if (paperCard.isFoil() && c.getOriginal().getFoilIndex() == 0) {
c.getOriginal().setRandomFoil();
c.getOriginal().setFoilIndex(1); // FIXME should assign random foil here
}
showCard(c, false);
} else {

View File

@@ -18,6 +18,9 @@
package forge.view.arcane.util;
import javax.swing.*;
import org.apache.commons.lang3.StringUtils;
import java.awt.*;
import java.awt.font.FontRenderContext;
import java.awt.font.LineBreakMeasurer;
@@ -121,8 +124,11 @@ public class OutlinedLabel extends JLabel {
int textX = outlineSize, textY = 0;
int wrapWidth = Math.max(0, wrap ? size.width - outlineSize * 2 : Integer.MAX_VALUE);
AttributedString attributedString = new AttributedString(getText());
final String text = getText();
AttributedString attributedString = new AttributedString(text);
if (!StringUtils.isEmpty(text)) {
attributedString.addAttribute(TextAttribute.FONT, getFont());
}
AttributedCharacterIterator charIterator = attributedString.getIterator();
FontRenderContext fontContext = g2d.getFontRenderContext();