changeset 86:454a9fcd13ca

Turn antialiasing rendering hints on only for the needed elements to improve rendering speed and CPU usage.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 03 Mar 2011 16:33:02 +0200
parents e9fab3c96043
children 6afbf88c8bda
files game/Engine.java
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/game/Engine.java	Thu Mar 03 15:53:46 2011 +0200
+++ b/game/Engine.java	Thu Mar 03 16:33:02 2011 +0200
@@ -550,14 +550,6 @@
     {
         Graphics2D g2 = (Graphics2D) g;
         
-        // Use antialiasing when rendering the game elements
-        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                            RenderingHints.VALUE_ANTIALIAS_ON);
-
-        g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
-                            RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
-
-
         // Rescale if parent component size has changed
         Dimension dim = getSize();
         if (G.screenDim == null || !dim.equals(G.screenDim))
@@ -588,6 +580,14 @@
         
         // Draw background image, pieces, widgets
         g2.drawImage(G.lautaBGScaled, 0, 0, null);
+
+        // Use antialiasing when rendering the game elements
+        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                            RenderingHints.VALUE_ANTIALIAS_ON);
+
+        g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+                            RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+
         widgets.paint(g2);
 
         if (!lauta.flagGameOver)