summaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorfitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-04 22:13:45 +0000
committerfitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-04 22:13:45 +0000
commit39e5421e227986343931ae97ae92a2415e41bda7 (patch)
treecf1e8b0f67494ad8fd952eebb6f81d546e350cb4 /libjava
parent9130521e552c3adb62e7ab16428fb26f6832510c (diff)
downloadgcc-39e5421e227986343931ae97ae92a2415e41bda7.tar.gz
2005-05-04 Thomas Fitzsimmons <fitzsim@redhat.com>
* java/awt/BufferCapabilities.java: Document. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99234 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog4
-rw-r--r--libjava/java/awt/BufferCapabilities.java147
2 files changed, 140 insertions, 11 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 8380e6ce580..428d2fc1366 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,7 @@
+2005-05-04 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/BufferCapabilities.java: Document.
+
2005-05-04 Tom Tromey <tromey@redhat.com>
* java/nio/channels/FileLock.java (toString): Entirely avoid
diff --git a/libjava/java/awt/BufferCapabilities.java b/libjava/java/awt/BufferCapabilities.java
index 9f91711e18a..4ff2ba98d9f 100644
--- a/libjava/java/awt/BufferCapabilities.java
+++ b/libjava/java/awt/BufferCapabilities.java
@@ -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 @@ exception statement from your version. */
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 @@ public class BufferCapabilities implements Cloneable
}
catch (CloneNotSupportedException e)
{
- throw (Error) new InternalError().initCause(e); // Impossible
+ throw (Error) new InternalError().initCause(e);
}
}
-} // class BufferCapabilities
+}