home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.applet.Applet;
- import java.awt.AWTException;
- import java.awt.BufferCapabilities;
- import java.awt.Container;
- import java.awt.ImageCapabilities;
- import java.awt.Window;
- import java.awt.BufferCapabilities.FlipContents;
- import java.awt.event.ComponentAdapter;
- import java.awt.event.ComponentEvent;
- import java.awt.event.WindowEvent;
- import java.awt.event.WindowListener;
- import java.awt.image.BufferStrategy;
- import java.lang.ref.WeakReference;
- import java.lang.reflect.InvocationTargetException;
- import java.util.logging.Level;
- import sun.awt.SubRegionShowable;
-
- class BufferStrategyPaintManager$BufferInfo extends ComponentAdapter implements WindowListener {
- private WeakReference<BufferStrategy> weakBS;
- private WeakReference<Container> root;
- private boolean usingFlip;
- private boolean inSync;
- private boolean contentsLostDuringExpose;
- private boolean paintAllOnExpose;
- // $FF: synthetic field
- static final boolean $assertionsDisabled = !BufferStrategyPaintManager.class.desiredAssertionStatus();
- // $FF: synthetic field
- final BufferStrategyPaintManager this$0;
-
- public BufferStrategyPaintManager$BufferInfo(BufferStrategyPaintManager var1, Container var2) {
- this.this$0 = var1;
- this.root = new WeakReference(var2);
- var2.addComponentListener(this);
- if (var2 instanceof Window) {
- ((Window)var2).addWindowListener(this);
- }
-
- }
-
- public void setPaintAllOnExpose(boolean var1) {
- this.paintAllOnExpose = var1;
- }
-
- public boolean getPaintAllOnExpose() {
- return this.paintAllOnExpose;
- }
-
- public void setContentsLostDuringExpose(boolean var1) {
- this.contentsLostDuringExpose = var1;
- }
-
- public boolean getContentsLostDuringExpose() {
- return this.contentsLostDuringExpose;
- }
-
- public void setInSync(boolean var1) {
- this.inSync = var1;
- }
-
- public boolean isInSync() {
- return this.inSync;
- }
-
- public Container getRoot() {
- return this.root == null ? null : (Container)this.root.get();
- }
-
- public BufferStrategy getBufferStrategy(boolean var1) {
- BufferStrategy var2 = this.weakBS == null ? null : (BufferStrategy)this.weakBS.get();
- if (var2 == null && var1) {
- var2 = this.createBufferStrategy();
- if (var2 != null) {
- this.weakBS = new WeakReference(var2);
- }
-
- if (BufferStrategyPaintManager.access$700().isLoggable(Level.FINER)) {
- BufferStrategyPaintManager.access$700().finer("getBufferStrategy: created bs: " + var2);
- }
- }
-
- return var2;
- }
-
- public boolean usingFlip() {
- return this.usingFlip;
- }
-
- public boolean hasBufferStrategyChanged() {
- Container var1 = this.getRoot();
- if (var1 != null) {
- Object var2 = null;
- BufferStrategy var3 = null;
- BufferStrategy var8 = this.getBufferStrategy(false);
- if (var1 instanceof Window) {
- var3 = ((Window)var1).getBufferStrategy();
- } else {
- try {
- var3 = (BufferStrategy)BufferStrategyPaintManager.access$800().invoke(var1);
- } catch (InvocationTargetException var5) {
- if (!$assertionsDisabled) {
- throw new AssertionError();
- }
- } catch (IllegalArgumentException var6) {
- if (!$assertionsDisabled) {
- throw new AssertionError();
- }
- } catch (IllegalAccessException var7) {
- if (!$assertionsDisabled) {
- throw new AssertionError();
- }
- }
- }
-
- if (var3 != var8) {
- if (var8 != null) {
- var8.dispose();
- }
-
- this.weakBS = null;
- return true;
- }
- }
-
- return false;
- }
-
- private BufferStrategy createBufferStrategy() {
- Container var2 = this.getRoot();
- if (var2 == null) {
- return null;
- } else {
- BufferStrategy var3 = null;
- if (BufferStrategyPaintManager.access$900()) {
- var3 = this.createBufferStrategy(var2, FlipContents.COPIED);
- this.usingFlip = true;
- if (BufferStrategyPaintManager.access$700().isLoggable(Level.FINER)) {
- BufferStrategyPaintManager.access$700().finer("createBufferStrategy: using flip strategy");
- }
- }
-
- if (var3 == null) {
- var3 = this.createBufferStrategy(var2, (BufferCapabilities.FlipContents)null);
- this.usingFlip = false;
- }
-
- if (!(var3 instanceof SubRegionShowable)) {
- var3 = null;
- }
-
- return var3;
- }
- }
-
- private BufferStrategy createBufferStrategy(Container var1, BufferCapabilities.FlipContents var2) {
- BufferCapabilities var3 = new BufferCapabilities(new ImageCapabilities(true), new ImageCapabilities(true), var2);
- BufferStrategy var4 = null;
- if (var1 instanceof Applet) {
- try {
- BufferStrategyPaintManager.access$1000().invoke(var1, 2, var3);
- var4 = (BufferStrategy)BufferStrategyPaintManager.access$800().invoke(var1);
- } catch (InvocationTargetException var7) {
- if (BufferStrategyPaintManager.access$700().isLoggable(Level.FINER)) {
- BufferStrategyPaintManager.access$700().log(Level.FINER, "createBufferStratety failed", var7);
- }
- } catch (IllegalArgumentException var8) {
- if (!$assertionsDisabled) {
- throw new AssertionError();
- }
- } catch (IllegalAccessException var9) {
- if (!$assertionsDisabled) {
- throw new AssertionError();
- }
- }
- } else {
- try {
- ((Window)var1).createBufferStrategy(2, var3);
- var4 = ((Window)var1).getBufferStrategy();
- } catch (AWTException var6) {
- if (BufferStrategyPaintManager.access$700().isLoggable(Level.FINER)) {
- BufferStrategyPaintManager.access$700().log(Level.FINER, "createBufferStratety failed", var6);
- }
- }
- }
-
- return var4;
- }
-
- public void dispose() {
- Container var1 = this.getRoot();
- if (BufferStrategyPaintManager.access$700().isLoggable(Level.FINER)) {
- BufferStrategyPaintManager.access$700().log(Level.FINER, "disposed BufferInfo for: " + var1);
- }
-
- if (var1 != null) {
- var1.removeComponentListener(this);
- if (var1 instanceof Window) {
- ((Window)var1).removeWindowListener(this);
- }
-
- BufferStrategy var2 = this.getBufferStrategy(false);
- if (var2 != null) {
- var2.dispose();
- }
- }
-
- this.root = null;
- this.weakBS = null;
- }
-
- public void componentHidden(ComponentEvent var1) {
- Container var2 = this.getRoot();
- if (var2 != null && var2.isVisible()) {
- var2.repaint();
- } else {
- this.setPaintAllOnExpose(true);
- }
-
- }
-
- public void windowIconified(WindowEvent var1) {
- this.setPaintAllOnExpose(true);
- }
-
- public void windowClosed(WindowEvent var1) {
- synchronized(this.this$0) {
- while(BufferStrategyPaintManager.access$200(this.this$0)) {
- try {
- this.this$0.wait();
- } catch (InterruptedException var5) {
- }
- }
-
- BufferStrategyPaintManager.access$300(this.this$0).remove(this);
- }
-
- this.dispose();
- }
-
- public void windowOpened(WindowEvent var1) {
- }
-
- public void windowClosing(WindowEvent var1) {
- }
-
- public void windowDeiconified(WindowEvent var1) {
- }
-
- public void windowActivated(WindowEvent var1) {
- }
-
- public void windowDeactivated(WindowEvent var1) {
- }
-
- // $FF: synthetic method
- static boolean access$500(BufferStrategyPaintManager$BufferInfo var0) {
- return var0.usingFlip;
- }
- }
-