X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbackend%2FSwingTerminal.java;h=aa49467372f143a785166e46cc15a7899f81a9c6;hb=bff0df27562e1cca8e6be47e7ace9bd5bb1adbfa;hp=eb1616bf741c5271afc226fe16d6f4a98e4732dd;hpb=b73fc652a8bae52fb3cf653d628cf749dce20324;p=fanfix.git diff --git a/src/jexer/backend/SwingTerminal.java b/src/jexer/backend/SwingTerminal.java index eb1616b..aa49467 100644 --- a/src/jexer/backend/SwingTerminal.java +++ b/src/jexer/backend/SwingTerminal.java @@ -36,6 +36,7 @@ import java.awt.Graphics2D; import java.awt.Graphics; import java.awt.Insets; import java.awt.Rectangle; +import java.awt.RenderingHints; import java.awt.Toolkit; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; @@ -578,7 +579,19 @@ public class SwingTerminal extends LogicalScreen ) { do { do { - clearPhysical(); + /* + * TODO: + * + * Under Windows and Mac (I think?), there was a problem + * with the screen not updating on the initial load. + * Adding clearPhysical() below "fixed" it, but at a + * horrible performance penalty on Linux which I am no + * longer willing to accept. + * + * Fix this in the "right" way for Windows/OSX such that + * the entire screen does not require a full redraw. + */ + // clearPhysical(); drawToSwing(); } while (swing.getBufferStrategy().contentsRestored()); @@ -1238,6 +1251,15 @@ public class SwingTerminal extends LogicalScreen // Draw the background rectangle, then the foreground character. assert (cell.isImage()); + + // Enable anti-aliasing + if (gr instanceof Graphics2D) { + ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_RENDERING, + RenderingHints.VALUE_RENDER_QUALITY); + } + gr.setColor(cell.getBackground()); gr.fillRect(xPixel, yPixel, textWidth, textHeight); @@ -1310,10 +1332,19 @@ public class SwingTerminal extends LogicalScreen cellColor.setBackColor(cell.getForeColor()); } + // Enable anti-aliasing + if (gr instanceof Graphics2D) { + ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_RENDERING, + RenderingHints.VALUE_RENDER_QUALITY); + } + // Draw the background rectangle, then the foreground character. gr2.setColor(attrToBackgroundColor(cellColor)); gr2.fillRect(gr2x, gr2y, textWidth, textHeight); + // Handle blink and underline if (!cell.isBlink() || (cell.isBlink() && cursorBlinkVisible)