Browse Source

Log choice of antialiasing settings.

pull/187/head
weisj 4 years ago
parent
commit
f7355b467e
  1. 16
      core/src/main/java/com/github/weisj/darklaf/graphics/StringPainter.java
  2. 5
      core/src/main/java/com/github/weisj/darklaf/task/FontDefaultsInitTask.java
  3. 2
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java

16
core/src/main/java/com/github/weisj/darklaf/graphics/StringPainter.java

@ -35,11 +35,11 @@ import javax.swing.*;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View;
import sun.swing.SwingUtilities2;
import com.github.weisj.darklaf.ui.OpacityBufferedUI;
import com.github.weisj.darklaf.util.*;
import sun.swing.SwingUtilities2;
public class StringPainter {
private static final Logger LOGGER = LogUtil.getLogger(StringPainter.class);
@ -264,9 +264,16 @@ public class StringPainter {
return g;
}
public static void paintOpacityBuffered(final Graphics g, final JComponent c, final OpacityBufferedUI ui) {
public static void paintOpacityBufferedUI(final Graphics g, final JComponent c, final OpacityBufferedUI ui) {
boolean opaqueBuffered = translucentAAPaintingEnabled && GraphicsUtil.isOpaqueBuffered(c);
if (opaqueBuffered) {
paintOpacityBuffered(g, c, ui);
} else {
ui.updateUI(g, c);
}
}
public static void paintOpacityBuffered(final Graphics g, final JComponent c, final OpacityBufferedUI ui) {
double scaleX = Scale.getScaleX((Graphics2D) g);
double scaleY = Scale.getScaleX((Graphics2D) g);
BufferedImage img = ImageUtil.createCompatibleImage((int) Math.round(scaleX * c.getWidth()),
@ -279,8 +286,5 @@ public class StringPainter {
ui.updateUI(imgGraphics, c);
imgGraphics.dispose();
g.drawImage(img, 0, 0, c.getWidth(), c.getHeight(), null);
} else {
ui.updateUI(g, c);
}
}
}

5
core/src/main/java/com/github/weisj/darklaf/task/FontDefaultsInitTask.java

@ -114,6 +114,11 @@ public class FontDefaultsInitTask implements DefaultsInitTask {
if (aaHint != null
&& aaHint != RenderingHints.VALUE_TEXT_ANTIALIAS_OFF
&& aaHint != RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT) {
LOGGER.fine(String.format("Setting '%s' = '%s'",
RenderingHints.KEY_TEXT_ANTIALIASING, aaHint));
LOGGER.fine(String.format("Setting '%s' = '%s'",
RenderingHints.KEY_TEXT_LCD_CONTRAST,
RenderingHints.KEY_TEXT_LCD_CONTRAST));
defaults.put(RenderingHints.KEY_TEXT_ANTIALIASING, aaHint);
defaults.put(RenderingHints.KEY_TEXT_LCD_CONTRAST,
desktopHints.get(RenderingHints.KEY_TEXT_LCD_CONTRAST));

2
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java

@ -307,7 +307,7 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi
@Override
public void update(final Graphics g, final JComponent c) {
StringPainter.paintOpacityBuffered(g, c, this);
StringPainter.paintOpacityBufferedUI(g, c, this);
}
@Override

Loading…
Cancel
Save