This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] document BufferCapabilities


Hi,

I committed this patch to libgcj and GNU Classpath HEAD.

Tom

2005-05-04  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* java/awt/BufferCapabilities.java: Document.

Index: java/awt/BufferCapabilities.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/BufferCapabilities.java,v
retrieving revision 1.3
diff -u -r1.3 BufferCapabilities.java
--- java/awt/BufferCapabilities.java	17 Feb 2005 07:48:23 -0000	1.3
+++ java/awt/BufferCapabilities.java	4 May 2005 22:10:11 -0000
@@ -1,4 +1,4 @@
-/* BufferCapabilities.java -- 
+/* BufferCapabilities.java -- double-buffering capabilities descriptor
    Copyright (C) 2002, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -39,79 +39,204 @@
 package java.awt;
 
 /**
- * Needs documentation...
+ * A double-buffering capability descriptor.  This class exposes
+ * details about the double-buffering algorithms used by image
+ * buffers.
+ *
+ * BufferCapabilities represents algorithms that involve at least two
+ * buffers but it can also specify so-called "multi-buffer" schemes
+ * involving more than two buffers.  This class describes the
+ * capabilities of the front and back buffers as well as the results
+ * of "flipping" -- that is, what happens when an image is transferred
+ * from the back buffer to the front buffer.
+ *
+ * Flipping may or may not be supported or may be supported only in
+ * fullscreen mode.  If it is not supported then "blitting" is implied
+ * -- that is, the contents of the back buffer are copied using a fast
+ * block transfer operation from the back buffer to the front buffer.
+ *
+ * The front buffer is the one that is displayed.
  *
  * @author Eric Blake (ebb9@email.byu.edu)
+ *
  * @see BufferStrategy#getCapabilities()
  * @see GraphicsConfiguration#getCapabilities()
+ *
  * @since 1.4
- * @status updated to 1.4, lacks documentation
  */
 public class BufferCapabilities implements Cloneable
 {
+  /**
+   * A type-safe enumeration of buffer flipping results.
+   *
+   * @see AttributeValue
+   */
   public static final class FlipContents extends AttributeValue
   {
+    /**
+     * The names of the different flipping results.
+     */
     private static final String[] NAMES
       = { "undefined", "background", "prior", "copied" };
+
+    /**
+     * The contents of the back buffer are undefined after flipping.
+     */
     public static final FlipContents UNDEFINED = new FlipContents(0);
+
+    /**
+     * The back buffer is cleared with the background color after
+     * flipping.
+     */
     public static final FlipContents BACKGROUND = new FlipContents(1);
+
+    /**
+     * The back buffer contains the pre-flipping contents of the front
+     * buffer after flipping.  In other words a true "flip" has been
+     * performed.
+     */
     public static final FlipContents PRIOR = new FlipContents(2);
+
+    /**
+     * The back buffer has the same contents as the front buffer after
+     * flipping.
+     */
     public static final FlipContents COPIED = new FlipContents(3);
+
+    /**
+     * Create a new flipping result descriptor.
+     *
+     * @param value the enumeration value
+     */
     private FlipContents(int value)
     {
       super(value, NAMES);
     }
-  } // class FlipContents
+  }
 
+  /**
+   * Front buffer capabilities descriptor.
+   */
   private final ImageCapabilities front;
+
+  /**
+   * Back buffer capabilities descriptor.
+   */
   private final ImageCapabilities back;
+
+  /**
+   * Describes the results of a "flip" operation.
+   */
   private final FlipContents flip;
 
   /**
    * Creates a buffer capabilities object.
    *
-   * @exception IllegalArgumentException If frontCaps or backCaps are null.
+   * @param frontCaps front buffer capabilities descriptor
+   * @param backCaps back buffer capabilities descriptor
+   * @param flipContents the results of a flip operation or null if
+   * flipping is not supported
+   *
+   * @exception IllegalArgumentException if frontCaps or backCaps is
+   * null
    */
-  public BufferCapabilities(ImageCapabilities front, ImageCapabilities back,
-                            FlipContents flip)
+  public BufferCapabilities(ImageCapabilities frontCaps,
+			    ImageCapabilities backCaps,
+                            FlipContents flipContents)
   {
+    if (front ==  null || back == null)
+      throw new IllegalArgumentException();
     this.front = front;
     this.back = back;
     this.flip = flip;
-    if (front ==  null || back == null)
-      throw new IllegalArgumentException();
   }
 
+  /**
+   * Retrieve the front buffer's image capabilities.
+   *
+   * @return the front buffer's image capabilities
+   */
   public ImageCapabilities getFrontBufferCapabilities()
   {
     return front;
   }
 
+  /**
+   * Retrieve the back buffer's image capabilities.
+   *
+   * @return the back buffer's image capabilities
+   */
   public ImageCapabilities getBackBufferCapabilities()
   {
     return back;
   }
 
+  /**
+   * Return whether or not flipping is supported.
+   *
+   * @return true if flipping is supported, false otherwise
+   */
   public boolean isPageFlipping()
   {
     return flip != null;
   }
 
+  /**
+   * Retrieve the result of a flipping operation.  If this method
+   * returns null then flipping is not supported.  This implies that
+   * "blitting", a fast block transfer, is used to copy the contents
+   * of the back buffer to the front buffer.  Other possible return
+   * values are:
+   * <ul>
+   *   <li><code>FlipContents.UNDEFINED</code> the contents of the
+   *   back buffer are undefined after flipping.</li>
+   *   <li><code>FlipContents.BACKGROUND</code> the contents of the
+   *   back buffer are cleared to the background color after
+   *   flipping.</li>
+   *   <li><code>FlipContents.PRIOR</code> the back buffer contains
+   *   the pre-flipping contents of the front * buffer after
+   *   flipping.</li>
+   *   <li><code>FlipContents.COPIED</code> the back buffer has the
+   *   same contents as the front buffer after flipping.</li>
+   * </ul>
+   *
+   * @return the result of a flipping operation or null if flipping is
+   * not supported
+   */
   public FlipContents getFlipContents()
   {
     return flip;
   }
 
+  /**
+   * Returns true if flipping is only supported in fullscreen mode.
+   *
+   * @return true if flipping is only supported in fullscreen mode,
+   * false otherwise
+   */
   public boolean isFullScreenRequired()
   {
     return true;
   }
 
+  /**
+   * Returns true if flipping can involve more than two buffers.  One
+   * or more intermediate buffers may be available in addition to the
+   * front and back buffers.
+   *
+   * @return true if there are more than two buffers available for
+   * flipping, false otherwise
+   */
   public boolean isMultiBufferAvailable()
   {
     return false;
   }
 
+  /**
+   * Clone this buffering capability descriptor.
+   *
+   * @return a clone of this buffer capability descriptor
+   */
   public Object clone()
   {
     try
@@ -120,7 +245,7 @@
       }
     catch (CloneNotSupportedException e)
       {
-        throw (Error) new InternalError().initCause(e); // Impossible
+        throw (Error) new InternalError().initCause(e);
       }
   }
-} // class BufferCapabilities
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]