public boolean getContentsLostDuringExpose() {
return contentsLostDuringExpose;
}
public void setInSync(boolean inSync) {
this.inSync = inSync;
}
/**
* Whether or not the contents of the buffer strategy
* is in sync with the window. This is set to true when the root
* pane paints all, and false when contents are lost/restored.
*/
public boolean isInSync() {
return inSync;
}
/**
* Returns the Root (Window or Applet) that this BufferInfo references.
*/
public Container getRoot() {
return (root == null) ? null : root.get();
}
/**
* Returns the BufferStartegy. This will return null if
* the BufferStartegy hasn't been created and <code>create</code> is
* false, or if there is a problem in creating the
* <code>BufferStartegy</code>.
*
* @param create If true, and the BufferStartegy is currently null,
* one will be created.
*/
public BufferStrategy getBufferStrategy(boolean create) {
BufferStrategy bs = (weakBS == null) ? null : weakBS.get();
if (bs == null && create) {
bs = createBufferStrategy();
if (bs != null) {
weakBS = new WeakReference<BufferStrategy>(bs);
}
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.finer("getBufferStrategy: created bs: " + bs);
}
}
return bs;
}
/**
* Returns true if using a flip buffer strategy.
*/
public boolean usingFlip() {
return usingFlip;
}
/**
* Returns true if the buffer strategy of the component differs
* from current buffer strategy.
*/
public boolean hasBufferStrategyChanged() {
Container root = getRoot();
if (root != null) {
BufferStrategy ourBS = null;
BufferStrategy componentBS = null;
ourBS = getBufferStrategy(false);
if (root instanceof Window) {
componentBS = ((Window)root).getBufferStrategy();
}
else {
try {
componentBS = (BufferStrategy)
getGetBufferStrategyMethod().invoke(root);
} catch (InvocationTargetException ite) {
assert false;
} catch (IllegalArgumentException iae) {
assert false;
} catch (IllegalAccessException iae2) {
assert false;
}
}
if (componentBS != ourBS) {
// Component has a different BS, dispose ours.
if (ourBS != null) {
ourBS.dispose();
}
weakBS = null;
return true;
}
}
return false;
}
/**
* Creates the BufferStrategy. If the appropriate system property
* has been set we'll try for flip first and then we'll try for
* blit.
*/
private BufferStrategy createBufferStrategy() {
BufferCapabilities caps;
=8= |