summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/javax
diff options
context:
space:
mode:
authorSteve Vaughan <[email protected]>2010-11-16 15:35:25 -0500
committerSteve Vaughan <[email protected]>2010-11-16 15:35:25 -0500
commit483d47795fd1b4bd4cf892960ced8e961f7a8a3c (patch)
treeb9829b8c17be03bc7f562c4d87f290d374c459f1 /src/nativewindow/classes/javax
parentdb4d7d198cc826bba871fea39461c3c8a2a3b1c6 (diff)
Clone Capabilities on input, providing a local copy when requested. This eliminates the cloning that was occuring for each swap buffer call.
This is the first step in implementing immutable Capabilities.
Diffstat (limited to 'src/nativewindow/classes/javax')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
index 47f02c7cc..42350e6c1 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
@@ -40,8 +40,10 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen,
Capabilities capsChosen, Capabilities capsRequested) {
this.screen = screen;
- this.capabilitiesChosen = capsChosen;
- this.capabilitiesRequested = capsRequested;
+
+ // Create "immutable" copies of capabilities.
+ this.capabilitiesChosen = (Capabilities) capsChosen.clone();
+ this.capabilitiesRequested = (Capabilities) capsRequested.clone();
}
public Object clone() {
@@ -56,12 +58,14 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
return screen;
}
+ // TODO: Return immutable instance.
public Capabilities getChosenCapabilities() {
- return (null!=capabilitiesChosen)?(Capabilities)capabilitiesChosen.clone():null;
+ return capabilitiesChosen;
}
+ // TODO: Return immutable instance.
public Capabilities getRequestedCapabilities() {
- return (null!=capabilitiesRequested)?(Capabilities)capabilitiesRequested.clone():null;
+ return capabilitiesRequested;
}
public AbstractGraphicsConfiguration getNativeGraphicsConfiguration() {