import jagdx.D3DPRESENT_PARAMETERS;
import jagdx.IDirect3DDevice;
import jagdx.IDirect3DSwapChain;
import jagdx.IUnknown;
import java.awt.Canvas;

public class Class151_Sub2_Sub2_Sub2 extends Class151_Sub2_Sub2 implements Interface28 {

   D3DPRESENT_PARAMETERS aD3DPRESENT_PARAMETERS10841;
   Class545_Sub2_Sub1 aClass545_Sub2_Sub1_10842;
   long aLong10843;
   long aLong10844;
   long aLong10845;
   int anInt10846;
   int anInt10847;
   boolean aBool10848 = false;
   boolean aBool10849 = false;
   Canvas aCanvas10850;


   void method14946(int var1, int var2) {
      this.method10();
      this.anInt10846 = var1;
      this.anInt10847 = var2;
      if(this.aBool10849) {
         this.aClass545_Sub2_Sub1_10842.method15860();
      }

      this.method151();
      super.method14947(var1, var2);
   }

   public void method151() {
      this.method10();
      this.aD3DPRESENT_PARAMETERS10841 = new D3DPRESENT_PARAMETERS(this.aCanvas10850);
      this.aD3DPRESENT_PARAMETERS10841.Windowed = true;
      this.aD3DPRESENT_PARAMETERS10841.BackBufferCount = 1;
      this.aD3DPRESENT_PARAMETERS10841.BackBufferWidth = this.anInt10846;
      this.aD3DPRESENT_PARAMETERS10841.BackBufferHeight = this.anInt10847;
      if(this.aBool10849) {
         this.aLong10843 = IDirect3DDevice.GetSwapChain(this.aClass545_Sub2_Sub1_10842.aLong10294, 0);
         this.aLong10845 = IDirect3DSwapChain.GetBackBuffer(this.aLong10843, 0, 0);
         this.aLong10844 = IDirect3DDevice.GetDepthStencilSurface(this.aClass545_Sub2_Sub1_10842.aLong10294);
      } else {
         if(!Class545_Sub2_Sub1.method15867(this.aClass545_Sub2_Sub1_10842.anInt10291, this.aClass545_Sub2_Sub1_10842.anInt10292, this.aClass545_Sub2_Sub1_10842.aLong10293, this.aClass545_Sub2_Sub1_10842.anInt9757, this.aD3DPRESENT_PARAMETERS10841)) {
            throw new RuntimeException();
         }

         int var1 = this.aD3DPRESENT_PARAMETERS10841.AutoDepthStencilFormat;
         this.aLong10843 = IDirect3DDevice.CreateAdditionalSwapChain(this.aClass545_Sub2_Sub1_10842.aLong10294, this.aD3DPRESENT_PARAMETERS10841);
         this.aLong10845 = IDirect3DSwapChain.GetBackBuffer(this.aLong10843, 0, 0);
         this.aLong10844 = IDirect3DDevice.CreateDepthStencilSurface(this.aClass545_Sub2_Sub1_10842.aLong10294, this.anInt10846, this.anInt10847, var1, this.aD3DPRESENT_PARAMETERS10841.MultiSampleType, this.aD3DPRESENT_PARAMETERS10841.MultiSampleQuality, false);
      }

      if(this.aBool10848) {
         this.method154();
      }

   }

   public int method2741() {
      return this.anInt10846;
   }

   Class151_Sub2_Sub2_Sub2(Class545_Sub2_Sub1 var1, Canvas var2, int var3, int var4, boolean var5) {
      super(var1);
      this.aCanvas10850 = var2;
      this.aClass545_Sub2_Sub1_10842 = var1;
      this.anInt10846 = var3;
      this.anInt10847 = var4;
      this.aBool10849 = var5;
      this.method151();
      this.aClass545_Sub2_Sub1_10842.method15844(this);
   }

   public void method153() {
      this.method10();
      this.aD3DPRESENT_PARAMETERS10841 = new D3DPRESENT_PARAMETERS(this.aCanvas10850);
      this.aD3DPRESENT_PARAMETERS10841.Windowed = true;
      this.aD3DPRESENT_PARAMETERS10841.BackBufferCount = 1;
      this.aD3DPRESENT_PARAMETERS10841.BackBufferWidth = this.anInt10846;
      this.aD3DPRESENT_PARAMETERS10841.BackBufferHeight = this.anInt10847;
      if(this.aBool10849) {
         this.aLong10843 = IDirect3DDevice.GetSwapChain(this.aClass545_Sub2_Sub1_10842.aLong10294, 0);
         this.aLong10845 = IDirect3DSwapChain.GetBackBuffer(this.aLong10843, 0, 0);
         this.aLong10844 = IDirect3DDevice.GetDepthStencilSurface(this.aClass545_Sub2_Sub1_10842.aLong10294);
      } else {
         if(!Class545_Sub2_Sub1.method15867(this.aClass545_Sub2_Sub1_10842.anInt10291, this.aClass545_Sub2_Sub1_10842.anInt10292, this.aClass545_Sub2_Sub1_10842.aLong10293, this.aClass545_Sub2_Sub1_10842.anInt9757, this.aD3DPRESENT_PARAMETERS10841)) {
            throw new RuntimeException();
         }

         int var1 = this.aD3DPRESENT_PARAMETERS10841.AutoDepthStencilFormat;
         this.aLong10843 = IDirect3DDevice.CreateAdditionalSwapChain(this.aClass545_Sub2_Sub1_10842.aLong10294, this.aD3DPRESENT_PARAMETERS10841);
         this.aLong10845 = IDirect3DSwapChain.GetBackBuffer(this.aLong10843, 0, 0);
         this.aLong10844 = IDirect3DDevice.CreateDepthStencilSurface(this.aClass545_Sub2_Sub1_10842.aLong10294, this.anInt10846, this.anInt10847, var1, this.aD3DPRESENT_PARAMETERS10841.MultiSampleType, this.aD3DPRESENT_PARAMETERS10841.MultiSampleQuality, false);
      }

      if(this.aBool10848) {
         this.method154();
      }

   }

   boolean method2748() {
      this.aBool10848 = false;
      return Class23.method813(IDirect3DDevice.SetDepthStencilSurface(this.aClass545_Sub2_Sub1_10842.aLong10294, 0L));
   }

   public boolean method154() {
      this.aBool10848 = true;
      return Class23.method812(IDirect3DDevice.SetRenderTarget(this.aClass545_Sub2_Sub1_10842.aLong10294, 0, this.aLong10845))?false:(Class23.method812(IDirect3DDevice.SetDepthStencilSurface(this.aClass545_Sub2_Sub1_10842.aLong10294, this.aLong10844))?false:super.method154());
   }

   public int method2742() {
      return this.anInt10847;
   }

   void method14947(int var1, int var2) {
      this.method10();
      this.anInt10846 = var1;
      this.anInt10847 = var2;
      if(this.aBool10849) {
         this.aClass545_Sub2_Sub1_10842.method15860();
      }

      this.method151();
      super.method14947(var1, var2);
   }

   public void method10() {
      if(this.aLong10845 != 0L) {
         IUnknown.Release(this.aLong10845);
         this.aLong10845 = 0L;
      }

      if(this.aLong10844 != 0L) {
         IUnknown.Release(this.aLong10844);
         this.aLong10844 = 0L;
      }

      if(this.aLong10843 != 0L) {
         IUnknown.Release(this.aLong10843);
         this.aLong10843 = 0L;
      }

      this.aClass545_Sub2_Sub1_10842.method15847(this);
   }

   void method16774() {
      if(this.aLong10845 != 0L) {
         IUnknown.Release(this.aLong10845);
         this.aLong10845 = 0L;
      }

      if(this.aLong10844 != 0L) {
         IUnknown.Release(this.aLong10844);
         this.aLong10844 = 0L;
      }

      if(this.aLong10843 != 0L) {
         IUnknown.Release(this.aLong10843);
         this.aLong10843 = 0L;
      }

      this.aClass545_Sub2_Sub1_10842.method15847(this);
   }

   public int method14948() {
      return IDirect3DSwapChain.Present(this.aLong10843, 0);
   }

   public int method2747() {
      return this.anInt10846;
   }

   public int method14945(int var1, int var2) {
      return IDirect3DSwapChain.Present(this.aLong10843, 0);
   }

   public int method2745() {
      return this.anInt10847;
   }

   public int method2746() {
      return this.anInt10847;
   }

   public void finalize() throws Throwable {
      this.method16776();
      super.finalize();
   }

   public boolean method149() {
      this.aBool10848 = true;
      return Class23.method812(IDirect3DDevice.SetRenderTarget(this.aClass545_Sub2_Sub1_10842.aLong10294, 0, this.aLong10845))?false:(Class23.method812(IDirect3DDevice.SetDepthStencilSurface(this.aClass545_Sub2_Sub1_10842.aLong10294, this.aLong10844))?false:super.method154());
   }

   public void method147() {
      this.method10();
      this.aD3DPRESENT_PARAMETERS10841 = new D3DPRESENT_PARAMETERS(this.aCanvas10850);
      this.aD3DPRESENT_PARAMETERS10841.Windowed = true;
      this.aD3DPRESENT_PARAMETERS10841.BackBufferCount = 1;
      this.aD3DPRESENT_PARAMETERS10841.BackBufferWidth = this.anInt10846;
      this.aD3DPRESENT_PARAMETERS10841.BackBufferHeight = this.anInt10847;
      if(this.aBool10849) {
         this.aLong10843 = IDirect3DDevice.GetSwapChain(this.aClass545_Sub2_Sub1_10842.aLong10294, 0);
         this.aLong10845 = IDirect3DSwapChain.GetBackBuffer(this.aLong10843, 0, 0);
         this.aLong10844 = IDirect3DDevice.GetDepthStencilSurface(this.aClass545_Sub2_Sub1_10842.aLong10294);
      } else {
         if(!Class545_Sub2_Sub1.method15867(this.aClass545_Sub2_Sub1_10842.anInt10291, this.aClass545_Sub2_Sub1_10842.anInt10292, this.aClass545_Sub2_Sub1_10842.aLong10293, this.aClass545_Sub2_Sub1_10842.anInt9757, this.aD3DPRESENT_PARAMETERS10841)) {
            throw new RuntimeException();
         }

         int var1 = this.aD3DPRESENT_PARAMETERS10841.AutoDepthStencilFormat;
         this.aLong10843 = IDirect3DDevice.CreateAdditionalSwapChain(this.aClass545_Sub2_Sub1_10842.aLong10294, this.aD3DPRESENT_PARAMETERS10841);
         this.aLong10845 = IDirect3DSwapChain.GetBackBuffer(this.aLong10843, 0, 0);
         this.aLong10844 = IDirect3DDevice.CreateDepthStencilSurface(this.aClass545_Sub2_Sub1_10842.aLong10294, this.anInt10846, this.anInt10847, var1, this.aD3DPRESENT_PARAMETERS10841.MultiSampleType, this.aD3DPRESENT_PARAMETERS10841.MultiSampleQuality, false);
      }

      if(this.aBool10848) {
         this.method154();
      }

   }

   public int method14944() {
      return IDirect3DSwapChain.Present(this.aLong10843, 0);
   }

   public void method150() {
      if(this.aLong10845 != 0L) {
         IUnknown.Release(this.aLong10845);
         this.aLong10845 = 0L;
      }

      if(this.aLong10844 != 0L) {
         IUnknown.Release(this.aLong10844);
         this.aLong10844 = 0L;
      }

      if(this.aLong10843 != 0L) {
         IUnknown.Release(this.aLong10843);
         this.aLong10843 = 0L;
      }

      this.aClass545_Sub2_Sub1_10842.method15847(this);
   }

   public void method148() {
      if(this.aLong10845 != 0L) {
         IUnknown.Release(this.aLong10845);
         this.aLong10845 = 0L;
      }

      if(this.aLong10844 != 0L) {
         IUnknown.Release(this.aLong10844);
         this.aLong10844 = 0L;
      }

      if(this.aLong10843 != 0L) {
         IUnknown.Release(this.aLong10843);
         this.aLong10843 = 0L;
      }

      this.aClass545_Sub2_Sub1_10842.method15847(this);
   }

   void method16775() throws Throwable {
      this.method16776();
      super.finalize();
   }

   void method16776() {
      if(this.aLong10845 != 0L) {
         IUnknown.Release(this.aLong10845);
         this.aLong10845 = 0L;
      }

      if(this.aLong10844 != 0L) {
         IUnknown.Release(this.aLong10844);
         this.aLong10844 = 0L;
      }

      if(this.aLong10843 != 0L) {
         IUnknown.Release(this.aLong10843);
         this.aLong10843 = 0L;
      }

      this.aClass545_Sub2_Sub1_10842.method15847(this);
   }

   void method16777() throws Throwable {
      this.method16776();
      super.finalize();
   }

   boolean method2743() {
      this.aBool10848 = false;
      return Class23.method813(IDirect3DDevice.SetDepthStencilSurface(this.aClass545_Sub2_Sub1_10842.aLong10294, 0L));
   }

   public void method152() {
      this.method10();
      this.aD3DPRESENT_PARAMETERS10841 = new D3DPRESENT_PARAMETERS(this.aCanvas10850);
      this.aD3DPRESENT_PARAMETERS10841.Windowed = true;
      this.aD3DPRESENT_PARAMETERS10841.BackBufferCount = 1;
      this.aD3DPRESENT_PARAMETERS10841.BackBufferWidth = this.anInt10846;
      this.aD3DPRESENT_PARAMETERS10841.BackBufferHeight = this.anInt10847;
      if(this.aBool10849) {
         this.aLong10843 = IDirect3DDevice.GetSwapChain(this.aClass545_Sub2_Sub1_10842.aLong10294, 0);
         this.aLong10845 = IDirect3DSwapChain.GetBackBuffer(this.aLong10843, 0, 0);
         this.aLong10844 = IDirect3DDevice.GetDepthStencilSurface(this.aClass545_Sub2_Sub1_10842.aLong10294);
      } else {
         if(!Class545_Sub2_Sub1.method15867(this.aClass545_Sub2_Sub1_10842.anInt10291, this.aClass545_Sub2_Sub1_10842.anInt10292, this.aClass545_Sub2_Sub1_10842.aLong10293, this.aClass545_Sub2_Sub1_10842.anInt9757, this.aD3DPRESENT_PARAMETERS10841)) {
            throw new RuntimeException();
         }

         int var1 = this.aD3DPRESENT_PARAMETERS10841.AutoDepthStencilFormat;
         this.aLong10843 = IDirect3DDevice.CreateAdditionalSwapChain(this.aClass545_Sub2_Sub1_10842.aLong10294, this.aD3DPRESENT_PARAMETERS10841);
         this.aLong10845 = IDirect3DSwapChain.GetBackBuffer(this.aLong10843, 0, 0);
         this.aLong10844 = IDirect3DDevice.CreateDepthStencilSurface(this.aClass545_Sub2_Sub1_10842.aLong10294, this.anInt10846, this.anInt10847, var1, this.aD3DPRESENT_PARAMETERS10841.MultiSampleType, this.aD3DPRESENT_PARAMETERS10841.MultiSampleQuality, false);
      }

      if(this.aBool10848) {
         this.method154();
      }

   }

   public int method14949(int var1, int var2) {
      return IDirect3DSwapChain.Present(this.aLong10843, 0);
   }

   void method16778() throws Throwable {
      this.method16776();
      super.finalize();
   }

   public int method2744() {
      return this.anInt10846;
   }

   void method16779() {
      if(this.aLong10845 != 0L) {
         IUnknown.Release(this.aLong10845);
         this.aLong10845 = 0L;
      }

      if(this.aLong10844 != 0L) {
         IUnknown.Release(this.aLong10844);
         this.aLong10844 = 0L;
      }

      if(this.aLong10843 != 0L) {
         IUnknown.Release(this.aLong10843);
         this.aLong10843 = 0L;
      }

      this.aClass545_Sub2_Sub1_10842.method15847(this);
   }

   void method16780() {
      if(this.aLong10845 != 0L) {
         IUnknown.Release(this.aLong10845);
         this.aLong10845 = 0L;
      }

      if(this.aLong10844 != 0L) {
         IUnknown.Release(this.aLong10844);
         this.aLong10844 = 0L;
      }

      if(this.aLong10843 != 0L) {
         IUnknown.Release(this.aLong10843);
         this.aLong10843 = 0L;
      }

      this.aClass545_Sub2_Sub1_10842.method15847(this);
   }

   void method16781() {
      if(this.aLong10845 != 0L) {
         IUnknown.Release(this.aLong10845);
         this.aLong10845 = 0L;
      }

      if(this.aLong10844 != 0L) {
         IUnknown.Release(this.aLong10844);
         this.aLong10844 = 0L;
      }

      if(this.aLong10843 != 0L) {
         IUnknown.Release(this.aLong10843);
         this.aLong10843 = 0L;
      }

      this.aClass545_Sub2_Sub1_10842.method15847(this);
   }
}
