Code cleanup and formatting.
[sixth-3d.git] / src / main / java / eu / svjatoslav / sixth / e3d / gui / RenderingContext.java
index a16c2d5..afbe22d 100644 (file)
@@ -1,10 +1,10 @@
 /*
- * Sixth - System for data storage, computation, exploration and interaction.
- * Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- * 
+ * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of version 3 of the GNU Lesser General Public License
  * or later as published by the Free Software Foundation.
+ *
  */
 
 package eu.svjatoslav.sixth.e3d.gui;
@@ -20,21 +20,14 @@ import java.awt.image.WritableRaster;
 public class RenderingContext {
 
     public static final int bufferedImageType = BufferedImage.TYPE_4BYTE_ABGR;
-
-    public final BufferedImage bufferedImage;
-
     public final Graphics2D graphics;
-
-    public final byte[] bytes;
-
+    public final byte[] pixels;
     public final int width;
     public final int height;
-
     public final int xCenter;
     public final int yCenter;
-
     public final double zoom;
-
+    final BufferedImage bufferedImage;
     public int frameNumber = 0;
 
     /**
@@ -44,13 +37,17 @@ public class RenderingContext {
      */
     public boolean doRender = true; // TODO: make use of the variable
 
+    /**
+     * Mouse click. During rendering we can detect which item user clicked on.
+     */
     public MouseClick mouseClick;
 
+    /**
+     * Item that user clicked on.
+     */
     public MouseInteractionController clickedItem;
 
-    public RenderingContext(final int width, final int height,
-                            final RenderingContext oldContext) {
-
+    public RenderingContext(final int width, final int height) {
         this.width = width;
         this.height = height;
 
@@ -63,20 +60,11 @@ public class RenderingContext {
 
         final WritableRaster raster = bufferedImage.getRaster();
         final DataBufferByte dbi = (DataBufferByte) raster.getDataBuffer();
-        bytes = dbi.getData();
+        pixels = dbi.getData();
 
         graphics = (Graphics2D) bufferedImage.getGraphics();
-
-        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                RenderingHints.VALUE_ANTIALIAS_ON);
-
-        graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
-                RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
-
-        if (oldContext != null) {
-            mouseClick = oldContext.mouseClick;
-            clickedItem = oldContext.clickedItem;
-        }
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+        graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
     }
 
 }