forked from External/mage
GUI, performance: fixed memory/resources leaks on some components rendering
This commit is contained in:
parent
1f3fad6594
commit
83823acec7
18 changed files with 341 additions and 248 deletions
|
|
@ -330,12 +330,15 @@ public class CardIconsPanel extends JPanel {
|
|||
JLabel label = new JLabel();
|
||||
label.setToolTipText("<html>" + ManaSymbols.replaceSymbolsWithHTML(icon.getHint(), ManaSymbols.Type.CARD_ICON_HINT));
|
||||
if (!icon.getText().isEmpty()) {
|
||||
Graphics2D g2d = iconImageWithText.createGraphics();
|
||||
g2d.setColor(PreferencesDialog.getCurrentTheme().getCardIconsTextColor(this.color));
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
Rectangle rect = CardRendererUtils.reduceRect(new Rectangle(0, 0, iconImageWithText.getWidth(), iconImageWithText.getHeight()), 0.8f);
|
||||
CardRendererUtils.drawCenteredText(g2d, icon.getText(), rect, this.font, true);
|
||||
g2d.dispose();
|
||||
Graphics2D g2 = iconImageWithText.createGraphics();
|
||||
try {
|
||||
g2.setColor(PreferencesDialog.getCurrentTheme().getCardIconsTextColor(this.color));
|
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
Rectangle rect = CardRendererUtils.reduceRect(new Rectangle(0, 0, iconImageWithText.getWidth(), iconImageWithText.getHeight()), 0.8f);
|
||||
CardRendererUtils.drawCenteredText(g2, icon.getText(), rect, this.font, true);
|
||||
} finally {
|
||||
g2.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// the stretch icon can occupy all space (full grid's cell)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue